Calculate Time Lapsed between two dates.
Moderator: General Moderators
Calculate Time Lapsed between two dates.
I need to calculate time lapsed between two dates and return days, hours and minutes. (i.e. 4d 2hr 5m, 2hr 5m, 5m), does anyone has any simple script for this? Thanks...
This question has been asked (and answered) too many times...
You probably already know you need to use http://www.php.net/strtotime to get some unixtimestamps and make the difference. Then it's only a matter of divide / and module % by 60 to find out the remainder...
You probably already know you need to use http://www.php.net/strtotime to get some unixtimestamps and make the difference. Then it's only a matter of divide / and module % by 60 to find out the remainder...
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
People to don't come here to have code written for them... timvw actually gave the answer you needed and as mentioned it's been asked LOTS of times on the forum. We have a search feature so I suggest you search for "date difference" with "all terms" selected. There's plenty of posts like this...quadoc wrote:ok Mr.Guru, why don't you post some mean and lean code instead of nothing.
viewtopic.php?t=32137&highlight=date+difference