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. 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. 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")); 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
Archived
This topic is now archived and is closed to further replies.