Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread update year in dates
Wed, Feb 20 2008 5:19 AMPermanent Link

"Harry de Boer"
LS,

-What's the correct statement to update the year portion of a date column?
-Does this raize an error with leap years?

Regards, Harry

Wed, Feb 20 2008 9:57 AMPermanent Link

"Rita"
Try something like
update TABLENAME
set [DATEFIELD] = CDate( Format$([DATEFIELD], "MM/DD/") & "2003" )
where Year([DATEFIELD]) = 1903


"Harry de Boer" <harry@staaf.nl> wrote in message
news:3E204A92-C0D6-4B99-AE09-CACA181D3585@news.elevatesoft.com...
> LS,
>
> -What's the correct statement to update the year portion of a date column?
> -Does this raize an error with leap years?
>
> Regards, Harry
>
>

Wed, Feb 20 2008 11:03 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Nah - its them bloody INTERVAL's again


Harry you need something like

update table set _date =_date + interval 1 year

Tried it for a  leap year and it moved 2004-02-29 to 2005-03-01

Roy Lambert
Image