Richard Davey wrote:

Hello Eric,

Tuesday, March 9, 2004, 11:46:23 PM, you wrote:

ES> We have a table with a Date Time field and we need to update only the date
ES> portion of that field.

ES> We have table a with field Foo with value '2004-01-01 12:15:00' and a date
ES> '2004-03-01' and we need to change the date portion of Foo to the date and
ES> leave the time part alone.

ES> So Foo would change from:
ES> '2004-01-01 12:15:00'
ES> to:
ES> '2004-03-01 12:15:00'

I would have thought that:

UPDATE x SET y = DATE_ADD(y, INTERVAL 2 DAY)



But that is adding two days, the original query was to add two months, so presumably
it should be "INTERVAL 2 MONTH" - but beware that MySQL does some
seriously bizarre things with dates - for example adding 2 months to 31st Dec
takes you to 31st Feb which probably isn't what you want.


would work and not alter the time, but only a test will tell.






-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to