SureshKumar Vegesna SureshKumar Vegesna - 9 months ago 27
PHP Question

adding two time values of similar formats using php

i have two time values as give below

$time = 06:58:00;
$time2 = 00:40:00;

I am doing this for calculating the appointments and available time for a particular user
so i tried in this way

$max_date=abs(strtotime($time) + strtotime($time2));

but it is returning $max_date =2673452280
any suggestions pls


this code sample would take hour in $time and add the hour in $time2 to it

for example: time=06:58:00, time2=00:40:00, result = 07:38:00

$time = "06:58:00";
$time2 = "00:40:00";

$secs = strtotime($time2)-strtotime("00:00:00");
$result = date("H:i:s",strtotime($time)+$secs);