Hello i am having difficulties with mysql and php for my uni project. i have table that is used to store customer values including a start date and expiry date these values are stored as YYYY-MM-DD in one field each, i am trying to renew the expiry date. i retreive the customer information from the table in a varables, what i need to do is add one year to the expiry_date variable and send it back to the table. i have tried adding 1 to the expiry_date variable but rather then 2005-02-27 i get 2005 no month or day ?? Any ideas? Thanks Dave
see ADDDATE, ADDTIME, DATE_ADD in http://www.mysql.com/doc/en/Date_and_time_functions.html
In more recent MySQL versions, and in postgresql and firebird:
select cast ('2003-04-01' as date) + interval '1 year';
should work.
It's the SQL 92 spec way of doing it, and is the most portable method.
Thanks Guys I have got it working now 🙂 Dave