tags:

views:

20

answers:

1

Hi friends, I have the two times like this
2010-08-09 11:16:06
2010-08-09 11:19:12
I need to find out the time difference between these two dates and also I need to store difference between these two.For example here the difference is 00:03:02 And if the user again start the timer and stop it for example the second starting time is
2010-08-09 11:21:06
End time is 2010-08-09 11:22:12
I need to add this into the previous timer like 00:03:02+00:01:06 and need to display total duration is 00:04:08. Ps:It may be starting and end time difference in days.
How can I do this? Any help appreciated.

+2  A: 
  • Store the duration in seconds
  • Use strototime to convert dates into timestamps
  • Use date to convert timestamps into dates
  • Calculate second differences by subtracting the timestamps
  • Calculate offset timestamps by adding the second difference to their timestamps
Artefacto