PHP library to generate user friendly relative timestamps

date, php, time

Solution

Since there didn't seem to be any library, I've made one myself and got it included in PEAR:

Date_HumanDiff, http://pear.php.net/package/Date_HumanDiff

Code is at http://github.com/pear/Date_HumanDiff

Problem

I'm looking for a PHP library that generates user-friendly representations of times - for example "two hours ago" when the timestamp is `time() - 2 * 3600`. There are several existing questions with answers and blog posts (1, 2, 3), but all only contain code snippets - not a library I can install and upgrade. Django has one, Python also has a standalone lib, Javascript has several (1, 2, 3), too - where is the PHP library? A library should have the following things: - documentation - PEAR installable - regular releases - (optional) translations

Original source

Related problems