skip to main content

Time is relative
updated by rck, 2006-02-03

Instead of thinking about time in absolute numbers, we often think relative. Like “I bought a new pair of shoes yesterday”, “My car's windshield broke this morning” (sad but true) or “I will start dieting. Tomorrow.”

Time is easier to grab this way, that's why you often find such relative time hints in various blogs and online publications also. Instead of showing an absolute date, vBulletin for example writes “Yesterday, 6.00am”. Google Desktop shows hints like “9 min ago” for its RSS feeds (Web Clips).

Going phpWebSite

and... action!
and... action!
This approach of showing up intervals instead of absolute numbers makes it easier to comprehend time and date, not only for me. So I wanted to have that on my phpWebSite, too. This time, I didn't just hack one particular module. No, I wrote a new function for core/TimeDate.php, so this way of showing time-spans would be available all over phpWebSite.

To use the new function “relativeTime()” in a module not listed in the mentioned thread, please:

1) do a “require_once(PHPWS_SOURCE_DIR . 'core/DateTime.php');”
2) do a “PHPWS_DateTime::relativeTime($timestamp);” where you'd like to have the relative timestamp.

I've shown how to do it for Article Manager and phpWSBB, you should be able to convert this technique to any other module you like to.


Where to get it?

You can get the technical details in this thread. Please feel free to reply in that thread regarding how to implement that in other modules or general questions / comments.

RSSComments - Make a comment
The comments are owned by the poster. We are not responsible for its content.
RSSAll Articles
2008, 2007, 2006, 2005, 2004

What's Related

Article Manager


Latest Updates

updated by freddiemac1993, 2013-06-14

Re: adventures
created by brittdavis10, 2012-02-23 (1 rply, 3 views)

Re: how to run phpwebsite...
created by alexander, 2011-08-25 (2 rpls, 3607 views)

Re: Forum tags
created by HaroldFaragher, 2011-08-22 (3 rpls, 8488 views)

Zu den KO2100 Foren