I wanted to display the age, in years, months, days, etc., of my old weblog entries.
I found Aidan Lister’s Duration.php. It defines a static method to convert a timestamp into a readable string.
// 2 hours, 20 minutes, 5 seconds $time = 60*60*2 + 20*60 + 5; // Convert to a string echo Duration::toString($time); echo "\n";
Useful. Thanks Aidan.
Possibly Related posts (machine generated):