General information
Category:
Coding, syntax & commands
>>Any thoughts on how to handle existing code to solve
>>the year 2000 problem.
>>
>>ajay
>For VFP3 you can add the following to the valid() event of a text box for dates:
>if alltrim(upper(set('CENTURY')))='ON' && Do only if 2 digit years in effect
> return 1
>endif
>
>if !empty(this.value) && need an input value
> if type('this.value')=='C'
> this.value=date()
> return 1
> endif
> if !empty(this.epoch) && need an epoch trigger
> if substr(str(year(this.value),4),1,2)='19' && may have used calendar control so only if 19xx
> if this.value> this.value=this.value+36525 && 100 years of 365 days plus 25 leaps
> return 1
> endif
> endif
> endif
>endif
>
>epoch is a custom property set to the rollover year (i.e. 1921, 1970 or whatever fits the app)
>
>HTH
One tiny problem with this. Try to enter the date 02/29/00, a valid date for year 2000. The problem here is that Feb 29, 1900 is not a valid date (not a leap year).
I must admit though, that I have used this work-around in all of my 2.6 apps and plan to hide when my clients want to enter 02/29/00! :)
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