Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert two-digit year in date
Message
From
01/11/2007 15:42:57
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01265173
Message ID:
01265856
Views:
9
>>Also
>>SET CENTURY ON
>>SET CENTURY TO 19 ROLLOVER 20
>>? CTOD("01/01/50") && 01/01/1950
>>? CTOD("01/01/10") && 01/01/2010
>>
>>This was introduce for the Y2K issue. Every think before today is in this century, and every thing after today date is considered last century.
>
>Greg,
>If you use SET CENTURY TO 19 ROLLOVER 20 my mother's birthday 01/10/19 would convert to 01/10/2019 instead of the correct 01/10/1919.
>
>I think you woud want to use either
>SET CENTURY TO 19 ROLLOVER 8 && good for two months then change the 8 to 9
>or
>rollyear = VAL(SUBSTR(STR(YEAR(DATE()) + 1),3,2))
>SET CENTURY TO 19 ROLLOVER rollyear && gives you 99 years ago
>
>Sammie

Interesting. You are right. It has been nearly 10 years sence I played with the command and I recall it took some fancing coding then to get it give the expected result. Sence Y2K and the fact I always develop application were date entries are always 4 diget years, I have had no need for this command. But the command is still useful if one can figure out the proper settings.

If you do figure it out, write a page about solution on Fox.Wikis.com.

>>
>>>The Patient.ptDOB below is a 2-digit date. What is the simplest way to convert it to a 4-digit year date in a SQL statement? Thanks!
>>>
>>>
>>>PADR(THIS.Strip(TRANSFORM(Patient.PtDOB, '@T')), 30, ' ')   AS PID_07_00_DateOfBirth, ;
>>>
Greg Reichert
Previous
Reply
Map
View

Click here to load this message in the networking platform