Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Year 0000
Message
 
 
To
13/04/2005 18:57:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01003937
Message ID:
01004423
Views:
26
My question is how to trap years less than 1900 in valid of the textbox. It seems like this year is converted to 1900 by VFP... Try to play with form and textbox which is date type.

>>Ok, here is what I found: all dates before 03/01/0000 are considered invalid dates and the message is shown. All dates with date later than 03/01/0000 including that date are considered valid dates. That's VFP native behavior.
>>
>>Do you have explanations for that?
>>
>>Thanks in advance.
>>
>
>Because before you have the 00 ( Big Bang ) day:
>
>clear
>? DATETIME(100,12,31,0,0,0)-(365*100+329)*86400
>? DATETIME(100,12,31,0,0,0)-(365*100+329)*86400-1 && look the day ! exists a little bug here, expected empty
>? DATETIME(100,12,31,0,0,0)-(365*100+330)*86400	  && the last computed datetime
>? DATETIME(100,12,31,0,0,0)-(365*100+330)*86400-1 && now the C++ routine trap the bad value
>
>minCorrectDatetime  = DATETIME(100,12,31,0,0,0)-(365*100+329)*86400
>
>minComputedDatetime = DATETIME(100,12,31,0,0,0)-(365*100+330)*86400
>* probe datetime C++ functions
>? DAY(minComputedDatetime)	,DAY(minCorrectDatetime)
>? TTOC(minComputedDatetime)	,TTOC(minCorrectDatetime)
>? DMY(minComputedDatetime)	,DMY(minCorrectDatetime)
>? MDY(minComputedDatetime)	,MDY(minCorrectDatetime)
>* NOW YOU HAVE SMASHED the limit of 03-01-0000
>? TTOD(minComputedDatetime)	,TTOD(minCorrectDatetime)
>* try on a variable
>x = TTOD(minComputedDatetime)
>? x  && not checked
>? x+0 && but this comes checked
>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform