News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
ThinkPHP Blog:
Put out the age of a date in words
April 11, 2008 @ 10:37:53

On the ThinkPHP blog today, Annika Rabea shares a method for outputting dates in words rather than in the usual numbers most applications use.

Recently, I have to output the age of a date in words and didn't have a framework to work with. The first steps were to parse the given date into an array and create a timestamp with the individual parts. The difference between the timestamp of now and the created timestamp yielded the age in seconds. The result can be used to compare with seconds of a day, week, etc.

The code snippet in the post outputs the difference between two timestamps (then and now) it a bit more friendly way (ex. 4 months, 2 weeks, 2 days).

0 comments voice your opinion now!
date format timestamp week month day output



Similar Posts

ThinkPHP Blog: Put out the age of a date in words

Photogapple.co.uk: time_since

Ed Finkler's Blog: Inspekt 0.3 now available

Builder.com.au: Get the correct time by converting between time zones with PHP and PEAR

DevShed: Generating Outputs from MySQL with Static Members and Methods in PHP 5


Community Events







Don't see your event here?
Let us know!


security release mysql developer book code example PHP5 conference framework PEAR cakephp zend package application job ajax zendframework database releases

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework