{"id":104,"date":"2011-12-08T07:39:25","date_gmt":"2011-12-08T15:39:25","guid":{"rendered":"http:\/\/shanelabs.com\/blog\/?p=104"},"modified":"2011-12-21T07:29:33","modified_gmt":"2011-12-21T15:29:33","slug":"days-until-christmas-in-php","status":"publish","type":"post","link":"https:\/\/shanelabs.com\/blog\/2011\/12\/08\/days-until-christmas-in-php\/","title":{"rendered":"Days Until Christmas in PHP"},"content":{"rendered":"<p>Here&#8217;s how to calculate the days until Christmas using PHP:<\/p>\n<pre>$daysuntilxmas = ceil((mktime(0,0,0,12,25,date('Y')) - time()) \/ 86400);\r\necho \"There are $daysuntilxmas days to Xmas!\";<\/pre>\n<p>You can combine this with my<a href=\"http:\/\/shanelabs.com\/blog\/2011\/12\/08\/end-of-the-day-countdown-in-javascript\/\"> End of the day countdown javascript<\/a> to have a realtime countdown with hours, minutes, and seconds. If you do that, decrement the $daysuntilxmas by 1 since you will already be counting partial days.<\/p>\n<p>Hope that helps!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s how to calculate the days until Christmas using PHP: $daysuntilxmas = ceil((mktime(0,0,0,12,25,date(&#8216;Y&#8217;)) &#8211; time()) \/ 86400); echo &#8220;There are $daysuntilxmas days to Xmas!&#8221;; You can combine this with my End of the day countdown javascript to have a realtime countdown with hours, minutes, and seconds. If you do that, decrement the $daysuntilxmas by 1 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,6],"tags":[],"class_list":["post-104","post","type-post","status-publish","format-standard","hentry","category-software","category-tech"],"_links":{"self":[{"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/posts\/104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/comments?post=104"}],"version-history":[{"count":6,"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/posts\/104\/revisions"}],"predecessor-version":[{"id":147,"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/posts\/104\/revisions\/147"}],"wp:attachment":[{"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/media?parent=104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/categories?post=104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shanelabs.com\/blog\/wp-json\/wp\/v2\/tags?post=104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}