swamp Posted July 1, 2009 Share Posted July 1, 2009 Hi, I've got a DATETIME column in my database ($dateExpires) I need to be able to add minuets to this (something like this..) $dateExpires = $row['date_expires']; //2009-07-01 11:03:00 $minsToAdd = 2 (mins); $newDateExpires = $dateExpires + $minsToAdd; Link to comment https://forums.phpfreaks.com/topic/164362-add-time-to-string/ Share on other sites More sharing options...
Adam Posted July 1, 2009 Share Posted July 1, 2009 print date("Y-m-d G:i:s", strtotime($row['date_expires'] . "+2 minutes")); Link to comment https://forums.phpfreaks.com/topic/164362-add-time-to-string/#findComment-867039 Share on other sites More sharing options...
swamp Posted July 1, 2009 Author Share Posted July 1, 2009 Legend. Cheers! Link to comment https://forums.phpfreaks.com/topic/164362-add-time-to-string/#findComment-867045 Share on other sites More sharing options...
trq Posted July 1, 2009 Share Posted July 1, 2009 Depending on what your doing exactly you might be better doing this within your query. UPDATE tbl SET date_expires = DATE_ADD(date_expires, + INTERVAL 2 SECOND); Link to comment https://forums.phpfreaks.com/topic/164362-add-time-to-string/#findComment-867049 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.