Skip to content
Advertisement

Tag: date-difference

Find difference between two datetimes and format at Y-m-d H:i:s

I’m trying to get the difference between two datetimes and return it as a datetime. I’ve found examples using diff but I can’t seem to get it right. However $totaltime logs 0000-00-00 00:00:00 to my DB. Is this because I’m not formatting my totaltime variable? Answer I’m not sure what format you’re looking for in your difference but here’s how

Advertisement