News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint WebTech Blog:
Give Your Visitors a Rough Time
March 06, 2008 @ 08:44:00

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.

0 comments voice your opinion now!
roughtime switch approximate time hour minute translate


blog comments powered by Disqus

Similar Posts

Sanisoft Blog: Multilingual apps with CakePHP

Brandon Savage's Blog: The Fallacy of Sunk Cost

Federico Cargnelutti's Blog: Format a time interval with the requested granularity

Enterprise PHP Magazine: Why Groupe Girard choosed PHP to J2EE to develop their ERP

Michelangelo van Dam's Blog: Zend Framework context switching for HTML content


Community Events

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


framework threedevsandamaybe podcast voicesoftheelephpant series unittest introduction laravel5 interview laravel community api language opinion library feature extension release wordpress development

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