millercj Posted March 15, 2015 Share Posted March 15, 2015 I'm attempting to add time: $a = mktime(0, 0, 12); $b = mktime(0, 0, 5); echo date('h:i:s', $a + $b); My echo is reading "03:00:17" Where the heck is the 3 hours coming from? Link to comment https://forums.phpfreaks.com/topic/295264-date-addition-error/ Share on other sites More sharing options...
Ch0cu3r Posted March 15, 2015 Share Posted March 15, 2015 Use strtotime or the DateTime object for adding time to an existing date. Adding two timestamps like that is not the correct way. Link to comment https://forums.phpfreaks.com/topic/295264-date-addition-error/#findComment-1508158 Share on other sites More sharing options...
millercj Posted March 15, 2015 Author Share Posted March 15, 2015 Gottcha...thanks DateTime it is Link to comment https://forums.phpfreaks.com/topic/295264-date-addition-error/#findComment-1508161 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.