plznty Posted January 27, 2011 Share Posted January 27, 2011 Im using $time = date('Y-m-d H:i:s'); How can I make a new variable that adds 4 hours on the $time output. Link to comment https://forums.phpfreaks.com/topic/225812-how-do-i-add-hours-to-date/ Share on other sites More sharing options...
Bradley99 Posted January 27, 2011 Share Posted January 27, 2011 +(Your seconds here); ? Link to comment https://forums.phpfreaks.com/topic/225812-how-do-i-add-hours-to-date/#findComment-1165809 Share on other sites More sharing options...
ManiacDan Posted January 27, 2011 Share Posted January 27, 2011 Bradley, that won't work, date() outputs a string. Ryan, what you want is to use the SECOND argument to date, which is a timestamp: date('Y-m-d H:i:s', strtotime('+4 hours')); //or date('Y-m-d H:i:s', time()+14400); -Dan Link to comment https://forums.phpfreaks.com/topic/225812-how-do-i-add-hours-to-date/#findComment-1165823 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.