1. <html>  
  2.  <body>  
  3. <?php
  4. $date1 = date(‘Y-m-d’); // yyyy-mm-dd format
  5. $date2 = ‘2006-07-01’;
  6. $days = (strtotime() – strtotime()) / (60 * 60 * 24);
  7. echo “Number of days since ‘2006-07-01’: $days”;
  8. ?>
  9.  </body>   
  10. </html>  

Where strtotime

int strtotime ( string $time [, int $now] )

The function expects to be given  a string containing a US English date format and will try to parse that format into a UNIX timestamp (the number of seconds since January 1 1970 00:00:00 GMT), relative to the timestamp given in now, or the current time if now is not supplied.

eXTReMe Tracker