refiking Posted January 6, 2008 Share Posted January 6, 2008 I am trying to store the date exactly 24 hours from the time the script is ran into my DB. What do I need to add to this to make the time be the exact time it is at the time the script is run, while keeping the date as the next day. Here's my current code: $date=mktime(0, 0, 0, date("m"), date("d")+1, date("y")); Quote Link to comment https://forums.phpfreaks.com/topic/84769-solved-help-with-date-function/ Share on other sites More sharing options...
cooldude832 Posted January 6, 2008 Share Posted January 6, 2008 strototime is a great function <?php echo "Now is: ".date("Y-m-d G:i:s"); echo "<br /> 24 Horus ago was: ".date("Y-m-d G:i:s", strototime("-1 Day")); echo "<br /> 24 Horus ahead of now is: ".date("Y-m-d G:i:s", strototime("+1 Day")); ?> Quote Link to comment https://forums.phpfreaks.com/topic/84769-solved-help-with-date-function/#findComment-432010 Share on other sites More sharing options...
refiking Posted January 6, 2008 Author Share Posted January 6, 2008 Parse error: parse error, unexpected T_STRING line 3 What is missing? Quote Link to comment https://forums.phpfreaks.com/topic/84769-solved-help-with-date-function/#findComment-432014 Share on other sites More sharing options...
cooldude832 Posted January 6, 2008 Share Posted January 6, 2008 try it again I had missed a couple of quote the first time Quote Link to comment https://forums.phpfreaks.com/topic/84769-solved-help-with-date-function/#findComment-432017 Share on other sites More sharing options...
cooldude832 Posted January 6, 2008 Share Posted January 6, 2008 there are a ton of things strtotime takes like +/- Days +/- Months +/- Weeks +/- Years a formatted date like YYYY/mm/dd with some delimerters (/,.,,,_) Quote Link to comment https://forums.phpfreaks.com/topic/84769-solved-help-with-date-function/#findComment-432023 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.