rmpotter 0 Posted November 25, 2009 Report 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? Quote Link to post Share on other sites
justsomeguy 1,135 Posted November 25, 2009 Report 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. Quote Link to post Share on other sites
rmpotter 0 Posted November 25, 2009 Author Report 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 Quote Link to post Share on other sites
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.