Login   Register  
PHP Classes
elePHPant
Icontem

Kind of ridiculous

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP Time Difference  >  All threads  >  Kind of ridiculous  >  (Un) Subscribe thread alerts  
Subject:Kind of ridiculous
Summary:PHP has built-in classes for this
Messages:3
Author:Michael Richey
Date:2013-05-18 17:48:04
Update:2013-05-25 16:02:33
 

  1. Kind of ridiculous   Reply  
Picture of Michael Richey
Michael Richey
2013-05-18 17:48:04
$now = new DateTime('now');
$birthday = new DateTime('1/21/1974'); // any date/time format PHP supports
$interval = $birthday->diff($now);
echo $interval->format('%y years, %m months, %d days');

  2. Re: Kind of ridiculous   Reply  
Picture of Andrzej Krokos
Andrzej Krokos
2013-05-19 18:19:56 - In reply to message 1 from Michael Richey
in the new version - yes, but in older ...

  3. Re: Kind of ridiculous   Reply  
Picture of Michael Richey
Michael Richey
2013-05-25 16:02:33 - In reply to message 2 from Andrzej Krokos
You listed this class as being for PHP 5, which ships with DateTime and DateTimeInterval ...