Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DATE function lowest year 100
Message
 
To
12/04/2005 13:01:08
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01003666
Message ID:
01003864
Views:
14
Cetin:

SET DATE TO GERMAN
mydate = CTOD(01.04.0005)
? mydate
? YEAR(mydate)
? DATE(YEAR(mydate),04,01)

The last one gives an error.

Andreas


>Andreas,
>Show me reproducing code.
>OTOH it's possible to write to a date field an invalid entry like the one you showed lowlevel (date is stored as a string in YYYYMMDD format).
>Cetin
>
>>The problem is that actually a date can hold year values from 0 to 99. If set century is on a user can simply enter e.g. a year 5. As well it's possible to create such a date with CTOD(). I use a third-party tool called foxaudit. This audit trail recorded a user's entry of a date 01.04.0000 (form field entry). Using this log leaded to the problem with the function DATE(). Of course I can check YEAR() < 100 and then use CTOD() instead of DATE(). I was just curious why Microsoft allows years below 100 with intput fields and CTOD and restricts DATE() to years >= 100. Needless to say that it makes sense to validate a user's entry.
>>
>>Andreas
>>
>>>>Hi,
>>>>
>>>>I just had some problems with the DATE() function. This function allows only dates equal or greater 100. Why? A date field can hold year values between 0 and 99. Retrieving such a year with YEAR() and later using it in DATE() leads to an error. This seems to be a bit weird to me. Need a go back to CTOD for date calculations?
>>>>
>>>>Andreas
>>>
>>>A date field cannot hold year values between 0 and 99. If you have such a need you have to create your own function and possibly save as text or 3 int fields.
>>>Cetin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform