1

I have a time currently displaying like this:

Thu Sep 12 04:28:37 +0000 2013 

I know that with PHP's strtotime you can input things like '2 days ago' or 'last week', but what I want to do is input the timestamp I already have, and output something like '3 hours ago' or '1 day ago' in my HTML.

Is there a way to do this?

CaribouCode
  • 13,998
  • 28
  • 102
  • 174

1 Answers1

1

There is no build in way. check out this post: Converting timestamp to time ago in PHP e.g 1 day ago, 2 days ago...

use it like time_elapsed_string(strtotime("Thu Sep 12 04:28:37 +0000 2013"))

Community
  • 1
  • 1
dognose
  • 20,360
  • 9
  • 61
  • 107
  • Ah cool thanks! Yeh that looks like the sorta thing I need. Shame it's not a build in function though when it can do it the other way round. – CaribouCode Sep 12 '13 at 10:33