0

I am looking to take a datetime and figure out how much time has lapsed since then...

for example, I have the following timestamp

2018-01-11 09:10:37

and I would like to output something like

2 days, 15 minutes

any ideas on how I can do that?

floriank
  • 25,546
  • 9
  • 42
  • 66
Jeffrey L. Roberts
  • 2,844
  • 5
  • 34
  • 69
  • This is not a duplicate of the mentioned question, the mentioned question uses timestamp comparison and strtotime(). Days don't have fixed length so the best way to do this is to create two datetime objects and use the diff() method. – dhinchliff Jan 15 '18 at 22:44
  • There is one relevant answer though: https://stackoverflow.com/a/29099815/1354691 – dhinchliff Jan 15 '18 at 22:46
  • https://stackoverflow.com/a/18602474/67332 – Glavić Jan 16 '18 at 14:39

0 Answers0