jbrill Posted April 7, 2009 Share Posted April 7, 2009 Hey guys, I have an entry in the database that holds the date (Y-m-d). Im simply trying to add 1 day to it. example: if the date in the database is 2009-04-06 in my php code i want to add grab that date and add 1 day to it so it would be 2009-04-07. how would i go about doing this? Link to comment https://forums.phpfreaks.com/topic/153032-how-to-add-a-day-to-a-determined-date/ Share on other sites More sharing options...
revraz Posted April 7, 2009 Share Posted April 7, 2009 http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html Link to comment https://forums.phpfreaks.com/topic/153032-how-to-add-a-day-to-a-determined-date/#findComment-803740 Share on other sites More sharing options...
jbrill Posted April 7, 2009 Author Share Posted April 7, 2009 Thanks for your help, but i want to do this in php, not using mysql. how would i do this? Link to comment https://forums.phpfreaks.com/topic/153032-how-to-add-a-day-to-a-determined-date/#findComment-803755 Share on other sites More sharing options...
PFMaBiSmAd Posted April 7, 2009 Share Posted April 7, 2009 Slow parsed/tokenized/interpreted php code will require at least two function calls and will be 10-20 times slower than doing it in your SELECT query when you retrieve your existing date field. Why wouldn't you want to do it in your query? Link to comment https://forums.phpfreaks.com/topic/153032-how-to-add-a-day-to-a-determined-date/#findComment-803777 Share on other sites More sharing options...
jbrill Posted April 7, 2009 Author Share Posted April 7, 2009 ok good call. My current query is: "SELECT * FROM `user_forgot_password` WHERE `hash`='".$hash."'" I have a "date" field that is date stamped when the user requested their password reset. I would like to give them one day to reset their password or else it would expire. how would i do this in an SQL statement? Link to comment https://forums.phpfreaks.com/topic/153032-how-to-add-a-day-to-a-determined-date/#findComment-803788 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.