News: Check number of days between 2 dates

Home News Photos News Videos News Cartoons News Blogs RSS

Home > PHP Scripts Examples and Tutorials > Check number of days between 2 dates

Check number of days between 2 dates

This is a little old function I have made, but up-to now it is very useful for me to include in many place: if you pass start date and end date to this function it will tell you how many days are pending or how many days are more. the result will be depending on your hand.

Thursday, Nov 30, 2006 | 1923 Views | Comments [View/Post]

function SafdateDiff($dformat, $endDate, $beginDate){ //send yyyy-mm-dd start and end get the number of days
     $date_parts1=explode($dformat, $beginDate);
     $date_parts2=explode($dformat, $endDate);
     $start_date=gregoriantojd($date_parts1[1], $date_parts1[2],$date_parts1[0]);
     $end_date=gregoriantojd($date_parts2[1], $date_parts2[2],$date_parts2[0]);
     return $end_date - $start_date;
 }

Description:
 I don't think I have to explain this, there is nothing to explain on this. He he.


Comment on this article
Guidelines: You must register with a social media account such as Facebook, Twitter, Yahoo, etc. to comment on this story. Click on the "Login" button below to choose your login account of choice. We welcome your thoughts, but this is not an open forum. For the sake of all readers, please refrain from the use of obscenities, personal attacks or racial slurs. All comments must remain on topic and cyber bullying will not be tolerated. All comments are subject to our terms of service. Comments that do not comply may be removed. Repeat offenders will lose commenting privileges.
News Other Language
World News
Movie News
Information
Travel News