Page 1 of 1

Data type for Date calculations in PHP5

Posted: Mon Jun 26, 2006 4:20 am
by technofreak
Hi,

i have an expiry date and activation date values in the database. I require to find out those rows with expiry date that are one month from today's date, as well as rows with activation dates in the past one month.

I have declared the expiry_date and activation_date fields in my database table as varchar(10) to support mm/dd/yyyy format. I had no idea of doing calculations that I mentioned above when designing the databse. As i don't have much data in the database altering the data type of those fields is not an issue.

rather, I want to know whats the data type for date, which i can declare over my mysql database, that will be helpful for these PHP calculations. Can i use DATE and TIMESTAMP types for these ?

Posted: Mon Jun 26, 2006 6:39 am
by Weirdan
the correct data type for date values is, obviously, DATE.