I am looking to add two times together that come from a sql query. Below is my code.
$taskID = $row['taskID'];
$startTimeRaw = $row['startTime'];
$endTimeRaw = $row['endTime'];
$everyMinutesRaw = $row['everyMinutes'];
$startTime = $startTimeRaw->format('H:i:s');
$endTime = $endTimeRaw->format('H:i:s');
$everyMinutes = $everyMinutesRaw->format('H:i:s');
#$latestRunTime = $startTime;
$latestRunTimeRaw = $startTime + $everyMinutes;
echo $startTime."<BR>";
echo $everyMinutes."<BR>";
echo $latestRunTime."<BR>";
This code returns the following
06:05:00
00:15:00
6
The third line of the return should be 06:20:00
, how can I make this change. I've played with strtotime
and ->format()
but none of it seems to get the proper answer. Thoughts?
With the data contained in the other answer I have this
$latestRunTime = strtotime($startTime) + strtotime($everyMinutes);
And it outputs
2733243600
If I format that, I get the following
Fatal error: Call to a member function format() on a non-object in