Link to home
Start Free TrialLog in
Avatar of ASPDEV
ASPDEV

asked on

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.

ASKER CERTIFIED SOLUTION
Avatar of ksparky
ksparky
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ASPDEV
ASPDEV

ASKER

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
Avatar of ASPDEV

ASKER

It worked, but I'm missing the TimeStamp, I get 00:00.

Needed valid ones like 01:50

Avatar of ASPDEV

ASKER

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))))
Avatar of ASPDEV

ASKER

Thanks
Avatar of Pavel Celba
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)))

Avatar of ASPDEV

ASKER

Cool, it worked as well.

Thanks