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,156
  • 22
  • 91
  • 166

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
  • 19,568
  • 9
  • 58
  • 104
  • 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