Get the days between now and the past  [ 860 views ]

Goal: figure out how to get days between two date

I’ve found a page: www.timeanddate.com with many interesting date time function. One of them was duration between two date. If you want to know how many days you lived on the Earth just put your birth date as the first date and the actual date to the second one and that’s it.

In this case I want to produce this function in php.

  $str = "Jan 01 1970";
  $str = strtotime(date("M d Y")) - (strtotime($str));
  echo floor($str/3600/24);

nota bene: online php tester

#sidebar a { color:#fff; } #sidebar ul ul li { color: #DEF585; } #sidebar h2 { color: #fff; } #sidebar ul p, #sidebar ul select { color: #BEDDBE; } #backfly { background: url(images/golfBallWallPaper.jpg) left bottom fixed repeat-x #65a51d; }