Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many days until X-Y-Z date? [closed]

Tags:

php

datetime

I am trying to build a count-down widget.

Given a certain date, whats the easiest way in PHP to determine how many days until that date?

like image 467
JD Isaacks Avatar asked Mar 17 '09 13:03

JD Isaacks


1 Answers

       <?php          $cdate = mktime(0, 0, 0, 12, 31, 2009);          $today = time();          $difference = $cdate - $today;          if ($difference < 0) { $difference = 0; }          echo floor($difference/60/60/24)." days remaining";        ?> 
like image 92
schnaader Avatar answered Oct 08 '22 21:10

schnaader