mattspriggs28 Posted August 11, 2010 Share Posted August 11, 2010 Hi, I am creating a date string using the following: $curDate = date("Y-m-d H:i:s"); However, what I want to do is take one hour off this so that $curDate now becomes the current date and time minus one hour. Thanks for your help. Quote Link to comment https://forums.phpfreaks.com/topic/210451-taking-an-hour-off-a-date-string/ Share on other sites More sharing options...
trq Posted August 11, 2010 Share Posted August 11, 2010 There are examples of this in the manual. date. Quote Link to comment https://forums.phpfreaks.com/topic/210451-taking-an-hour-off-a-date-string/#findComment-1098119 Share on other sites More sharing options...
AbraCadaver Posted August 11, 2010 Share Posted August 11, 2010 I prefer strtotime() over mktime(): $curDate = date("Y-m-d H:i:s", strtotime("-1 hour")); Quote Link to comment https://forums.phpfreaks.com/topic/210451-taking-an-hour-off-a-date-string/#findComment-1098135 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.