talking about...

PHP, Zend Framework, jQuery, Javascript, MySQL and other web development topics.

Get Difference Between 2 Dates Using PHP

Filed Under (General) by Wenbert on 29-01-2008

Tagged Under :

Here is how you get the number of days between two dates.

 
function getdays($day1,$day2)
{    
     return round((strtotime($day2)-strtotime($day1))/(24*60*60),0);
}
$begin = date("Y-m-d"); // we set today as an example
$end = "2007-01-29";
 
echo getdays($begin,$end).' days';

This was taken from the manual - posted by: michiel at mb-it dot nl

Related posts:

  1. Get Difference Between 2 Dates Using PHP Here is how to get the difference between two dates...
  2. Get number of hours between 2 timezones Here is a way to get the number of hours...
  3. PHP.net updates the Manual PHP.net has probably the best manual in world. All manuals...
  4. How to get the a date before current date in PHP Given 2008-01-31 as the current date and the value of...
  5. Cron job examples for newbies Here are a few examples from this site. 01 *...

Related posts brought to you by Yet Another Related Posts Plugin.

Leave a Reply

Subscribe to Rss Feed : Rss

Bad Behavior has blocked 619 access attempts in the last 7 days.