rmpotter Posted November 25, 2009 Share Posted November 25, 2009 I am looking for a simple way to save a date to MYSQL and then later extract it and add 60 days on to it. I am unsure the best format to save the date as for later extraction, currently I am using SQLs curdate() but feel using PHPs Date() may be easier to add time. Any ideas? Link to comment Share on other sites More sharing options...
justsomeguy Posted November 25, 2009 Share Posted November 25, 2009 It's best to save the integer timestamp that you get from the time() function. That will return the number of seconds since 1/1/70, so if you want to add 60 days you just add 60 days worth of seconds. A day has 86400 seconds. You can convert the timestamp back to a readable format with the date function, or you can get the timestamp for a specific date with the mktime function. Link to comment Share on other sites More sharing options...
rmpotter Posted November 25, 2009 Author Share Posted November 25, 2009 It's best to save the integer timestamp that you get from the time() function. That will return the number of seconds since 1/1/70, so if you want to add 60 days you just add 60 days worth of seconds. A day has 86400 seconds. You can convert the timestamp back to a readable format with the date function, or you can get the timestamp for a specific date with the mktime function.thanks, i'll give it a try Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.