Posted By

gfazioli on 04/14/10


Tagged

php date strtotime


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

umang_nine
eval
guillermoj88gmailcom


Date Difference in Days with PHP


 / Published in: PHP
 

URL: http://www.undolog.com

Calculate the difference from two date in days

  1. // Calculate the difference from two date in days
  2. $diff = (strtotime("2010-04-26") - strtotime("2010-02-05")) / 86400;
  3.  
  4. // To format now, for example, use date('Y-m-dì);
  5. $diff = (strtotime( date('Y-m-d') ) - strtotime("2010-02-05")) / 86400;

Report this snippet  

You need to login to post a comment.