Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add 6 months to a mysal date 1

Status
Not open for further replies.
Jul 28, 2005
358
FR
Hi,

I have dates stored in a table using the mysal date format (yyyy-mm-dd). I want to update the stored date so it is 6months later, but am unsure how to do it.

Any ideas?

Thanks,

Richard
 
I should probably mention that my myql version is 4.0.17

Thanks,

Richard
 
Try using the DATE_ADD function.

Something like
Code:
UPDATE table SET datum = DATE_ADD(datum, INTERVAL 6 MONTH) WHERE ....
shoud be suitable.

Andrew
Hampshire, UK
 
Thanks Andrew,

I worked out about the date_add function and had tested it on empty date fields (adding 6 months to the current date which I need to happen to). It's great to have it confirmed that I was on the right track and that I will be able to add 6 months to an already populated field.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top