# FoxPro 6.0 Update Year in the datetime field

Hello,
I can get  Year from FroPro 6.0

Select Year(Datetime) from Customer

I get year from all the rows.I need to update just Year in the Field How can I do that.

###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Have you tried
UPDATE Customer Set Datetime + 365.25

OR

UPDATE Customer Set Datetime = CTOD(allt(str(Month(Datetime))) + "/" + allt(str(Day(Datetime)) + "/" + allt(str(Year(Datetime)+1)))

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
How can I update just year:

e.g
02/09/2007 01:50

I need to change year from 2007 to 2010
like 02/09/2010 01:50
Author Commented:
It worked, but I'm missing the TimeStamp, I get 00:00.

Needed valid ones like 01:50

Author Commented:
I got it:

UPDATE Customer Set Datetime = CTOT(allt(str(Month(Datetime))) + "/" + allt(str(Day(Datetime))) + "/" + allt(str(Year(Datetime)+3)))) + allt(str(hour(datetime))) + ":" + allt(str(minute(datetime))))
Author Commented:
Thanks
Commented:
Above formula could fail when you try to update February 29th.

Shorter and region independent syntax is:

UPDATE Customer Set Datetime = DTOT(GOMONTH(Datetime, 36)) + (Datetime-DTOT(TTOD(Datetime)))

Author Commented:
Cool, it worked as well.

Thanks
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FoxPro

From novice to tech pro — start learning today.