I have always had a problem with adding and subtracting time like for an example:
10h:34min
+ 07h:46min
-------开发者_C百科----
XX:XX
Convert your time(s) to minutes, add them and re-calculate hours and minutes:
time in minutes ("tim"): (10 * 60 + 34) + (7 * 60 + 46)
result: floor(tim/60) : (tim%60)
floor(tim/60) will give you the whole hours
tim%60 is the "modulo" which is the integer "rest" of (tim/60)
If you work with whole dates (and times, not durations like it seems you do), try mktime and/ or strtotime which support operations like "+10 minutes" (and other).
精彩评论