News Feed
Sections
News Archive


Community Events
php|tek 2008 PHP Conference



SitePoint WebTech Blog:
Give Your Visitors a Rough Time
0 comments :: posted Thursday March 06, 2008 @ 08:44:00
voice your opinion now!

In a new post to the Web Tech blog over on SitePoint, Toby Somerville has posted something he calls "RoughTime" - his method for displaying a more "human friendly" output of a timestamp.

When asked the time, we generally don't need to be military accurate with our response [...] we generally communicate the approximate time. i.e. 'its nearly ten' or 'its just gone half past three'. Yet on the web, time is generally shown as '12:24:13 AM', or similar â€" not very visitor friendly.

His RoughTime uses two switch statements to map the hour and minute values to different strings. For example, minutes between 15 and 20 become "quarter past" and the hours are changed over from numeric versions to their word counterparts.

tagged with: roughtime switch approximate time hour minute translate



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

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