0

I am wondering how I would go about parsing the PHP datetime() function. As a default, I have my datetime() looking like this:

03/04/20 04:58:23

And my code for it looking like this:

$datetime = date("d/m/y h:i:s");

I haven't specified the timezone and other stuff yet, but I am wondering how I would parse date("d/m/y h:i:s"); to something more presentable or useful. For example, if Bob creates a topic on a forum, the date/time will say, "Just now." A few hours pass and the date/time will say, "6 hours ago." A week passes and the date/time will say, "A week ago." I am wondering how I would go about changing 03/04/20 04:58:23 to something similar to that. Will I have to check the date/time and change the text appropriately? Or is there already a parameter for date() or datetime()? Thanks! -Xp10d3 Note: I apologize if this is a bad question. I'm new to Stackoverflow and hope that you understand.

Blaz3ng
  • 1
  • 2
  • Hopefully the duplicate should give a good starting point, try it and see how it goes. If you have further problems create a new question with the code and what is not working. – Nigel Ren Apr 06 '20 at 18:33
  • Sorry; didn't realize there was a duplicate. I'll check that out; thanks for your help :D – Blaz3ng Apr 06 '20 at 18:35

0 Answers0