Hello,
How Can I add two times;
Example1
Time1: 2 day(s) 4hours 23minutes
Time2: 23:20 (23hours and 20minutes) { time two doesn't have any days}
How can we find the duration?
Example 2
Time 3: 30/04/2009 11:45
Time 4: 30/04/2009 23:34
| SitePoint Sponsor |

Hello,
How Can I add two times;
Example1
Time1: 2 day(s) 4hours 23minutes
Time2: 23:20 (23hours and 20minutes) { time two doesn't have any days}
How can we find the duration?
Example 2
Time 3: 30/04/2009 11:45
Time 4: 30/04/2009 23:34

Exactly what format are you getting the dates as, and where are they coming from?

These values are coming from another function;
but the exact format is
Time1: 2 days 4hours 23minutes
Time2: 11:15
as first we have to convert Time1 and Time2 to unix time stamp (which I don't know, I tried strtotime) but unsuccessful) and then adding them by some how,
looking forward

.. and the other function cannot be made to return reasonable data?
Time1: 2 days 4hours 23minutes
Time2: 11:15
Time1 2 days from when?
Time2: 11:15 what, am- pm , today? tomorrow?

Consider it to be entered by text fields
Example
Time 2:
Code:<input name="time" type="text" value="11:15" size="10" />

You are not making yourself clear.
Where are you getting 2days 4hours and 23minutes from?
What format is that in?
What do you want to do with it? Add it to something, if so what?
It might be a lot easier if you were to post an example of what you have, and what you want to end up with.
p.s. If you can influence the way the data is presented and you do want to use strtotime() then get the date in mm/dd/yyy order and it will work for you.
Bookmarks