-4

Googing for this seems impossible (obviously the mod was unable to read this correctly. I have bolded the issue to make it more obvious for those who's glasses prescription is off).

Are there any classes for taking an epoch date and displaying it "pretty" similar to facebook. So instead of a static date "8-20-13 5:23pm", it would be "2 hours from now", or "2 days" etc. I don't think it would terribly hard just time consuming to write. Anyone seen a simple class to deal with this?

Update: The answer for this is simple and Nick noted it below. Use the class DateInterval(). Without knowing the name of this class no combo of php, date and formating gets anything but using Date() in google.

Ryan Mills
  • 939
  • 1
  • 10
  • 23
  • 1
    see this: https://gist.github.com/krishnakummar/1053741 –  Aug 05 '13 at 19:31
  • This is off-topic for Stack Overflow. Please provide code of things you've tried or continue to consult Google. – Michael Irigoyen Aug 05 '13 at 19:32
  • http://stackoverflow.com/questions/2690504/php-producing-relative-date-time-from-timestamps another http://stackoverflow.com/a/111303/342740 and another http://stackoverflow.com/a/501415/342740 – Prix Aug 05 '13 at 19:32
  • I said right at the start I could not google for it. So dont bloody tell me to google for it... All i get are people trying to format a normal string as a static format. Learn to read before you mod my questions. If you would have just left it alone Nick answered it correctly. – Ryan Mills Aug 05 '13 at 19:41

1 Answers1

1

Use DateInterval and format it as you wish.

Nick
  • 14,291
  • 3
  • 17
  • 19