General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only