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. Quote 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); ? Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.