Posted By

lfatr on 02/16/10


Tagged

date


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

van_ucsd
luman
dantreacy


DATE DIFF


 / Published in: PHP
 

  1. <?php
  2.  
  3. function get_days() {
  4. // get current date
  5. $seconds=date("s");$minutes=date("i");$hours=date("h");$day=date("j");$month=date("n");$year=date("Y");
  6. // leaveing date
  7. $l_seconds=0;$l_minutes=0;$l_hours=0;$l_day=9;$l_month=6;$l_year=2008;
  8. // enddate -> startdate
  9. $dateDiff = mktime($hours,$minutes,$seconds,$month,$day,$year) - mktime($l_hours,$l_minutes,$l_seconds,$l_month,$l_day,$l_year);
  10. return floor($dateDiff/60/60/24);
  11. }
  12.  
  13. echo get_days();
  14. ?>

Report this snippet  

You need to login to post a comment.