Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Forcing 4 digit entry of the century part of a date
Message
From
14/09/1998 07:45:35
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
14/09/1998 07:33:55
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00136067
Message ID:
00136079
Views:
16
>Thanks for the speedy response.
>
>Unfortunatley part of my problem is that VFP is making an assumption and then putting in the century part of the date (4 digits), before I have time to trap it.
>
>Further more doesn't this piece of code make the assumption that every date entered will be in the 21st century.
>
>- This unfortunatley may not be the case.
>
>Regards,
>
>James.
James,
This one traps it before VFP assumption. Works on unformatted entry (as user entered).
Yes it makes an assumption every date entered will be in the 21st century. But it's an example code and can be extended for your needs and made into a class. Now in turn I should ask : How would you know the century if s/he keys only 9 or 18 for year ? If you mean to force strict 4 digit entry then simply return yeardigits entered LT 4
lnYearDigits = len(alltrim(substr(this.text,7)))
return (lnYearDigits < 4)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform