Posted By

level09 on 08/20/09


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

umang_nine
ReeceMarsland


Calcualte Day difference


 / Published in: PHP
 

  1. function daysDifference($endDate, $beginDate)
  2. {
  3. //explode the date by "-" and storing to array
  4. $date_parts1=explode("-", $beginDate);
  5. $date_parts2=explode("-", $endDate);
  6. //gregoriantojd() Converts a Gregorian date to Julian Day Count
  7. $start_date=gregoriantojd($date_parts1[1], $date_parts1[2], $date_parts1[0]);
  8. $end_date=gregoriantojd($date_parts2[1], $date_parts2[2], $date_parts2[0]);
  9. return $end_date - $start_date;
  10. }

Report this snippet  

You need to login to post a comment.