Posted under » PHP on 19 October 2012
Assuming you want to know how many more days to go before 27th January 2014 and now.
<¿php $today = date('Y-m-d'); $pieces = explode("-", $today); $today = MKTIME(12,0,0,$pieces[1],$pieces[2],$pieces[0]); $second_date = MKTIME(12,0,0,1,27,2014); $offset = $second_date-$today; ECHO FLOOR($offset/60/60/24) . " days"; ?>
MKTIME is the unix time. It is the only way to tell the difference in days between dates. It also can tell you the name of the day. From the previous example.
$second_date = MKTIME(12,0,0,12,25,2012); $deyy = date("D", $second_date); echo $deyy; // Tue
See also countdown days, DateTime class and timer app.