News Feed
Sections
News Archive


Community Events
php|tek 2008 PHP Conference



feed this:

ThinkPHP Blog:
Put out the age of a date in words
0 comments :: posted Friday April 11, 2008 @ 10:37:53
voice your opinion now!

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

tagged with: date format timestamp week month day output


Derick Rethans' Blog:
British date format parsing
0 comments :: posted Monday March 03, 2008 @ 20:45:49
voice your opinion now!

Derick Rethans has posted about a new function he's whipped up for PHP's date/time functionality to handle the differences between US formatted dates and the British date formats - date_create_from_format.

From PHP 5.3 the new date_create_from_format() function and the DateTime::createFromFormat() factory method are available. As first argument they accept the expected format, and as second argument the string to parse.

He includes two examples - one showing it being used to parse a British date string and the other to show off the date_get_last_errors function that can be useful for debugging.

tagged with: date format parse unitedstates british datecreatefromformat datetime


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

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