Forums / General / Converting dates to "time ago"

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Converting dates to "time ago"

Author Message

Deane Barker

Tuesday 31 July 2007 2:36:31 pm

I'm looking for a template operator that will take a date and convert it to "time ago." So it would take something like --

07/31/2007 11:34 AM

-- and convert it to something like this --

"Three hours ago"

Does anyone know of anything like this? I looked through the contributions, but didn't find anything.

André R.

Wednesday 01 August 2007 1:38:35 am

if you convert it to unix timestamp(the internal format used for date and date & time datatype) you can subtract it from current time to get how many seconds they diff.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom