Duration.php

I wanted to display the age, in years, months, days, etc., of my old weblog entries.

duration.png

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):

  1. Beyond The Template Engine
  2. More On PHP
  3. iPhone Viewport Meta Plugin for WordPress
  4. Sandbox and Strangelove: hAtom in WordPress
  5. Really, Catalogs Matter