...

View Full Version : Adding 90 days, and comparing dates



RyanB88
12-13-2008, 07:35 PM
I am writing a small script and I have two simular date related questions.

1) I have stored in a DB a date such as 12/13/2008, but the date stored could be any previous date, not just todays date, what I need to do is add 90 days to the date and echo that to the user

2) I would like to compare today's date with the value generated in question 1 to determain if today is the date generated or before, or after, then depending on that set a boolean that I would use to either show an message to the user or not.

PappaJohn
12-13-2008, 08:06 PM
MySQL provides a number of Date and Time functions (http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html) that will do what you want.

For example, for #1, you can look into DATE_ADD()

abduraooft
12-14-2008, 12:19 PM
1) I have stored in a DB a date such as 12/13/2008, but the date stored could be any previous date, not just todays date, what I need to do is add 90 days to the date and echo that to the user Take some effort to change them to the datetime format. All your other operations will be simplified then!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum