Date Difference in Days with PHP


/ Published in: PHP
Save to your folder(s)

Calculate the difference from two date in days


Copy this code and paste it in your HTML
  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;

URL: http://www.undolog.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.