Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bug in VFP date handling
Message
 
To
25/05/1999 14:23:39
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00222614
Message ID:
00222813
Views:
34
>Set
>
>SET SYSFORMATS ON
>
>in Visual FoxPro
>
>
>In Windows Control Panel / Regional Settings
>
>set date format to
>
>yy/dd/mm
>
>
>After this setting, many vfp date commands will stop working properly.
>
>For example,
>
>?ctod(dtoc(date()))=date()
>
>returns .f.
>
>
>Also, date in textbox control will appear differently when it has focus and when it doesnt have focus.
>
>So, single control panel setting change will stop many VFP programs
>working properly.

Andrus,

First, your date setting yy/dd/mm is not legal in VFP, at least in 5.0.

Second, CTOD is a bad beast. I extracted the following from Steven Black's site (www.stevenblack.com), VFP Localization issues, that I strongly recommend.

"Description: CTOD() converts a character expression to a date expression.

Internationalization gotcha: Remember that the format for the character expression must conform to the date format specified by SET DATE or by the "International" page of the Options dialog. So the command CTOD("9/24/96" ) works if SET DATE AMERICAN (month-day-year) but creates an empty date value ( / / ) if SET DATE BRITISH (day-month-year) or SET DATE JAPAN (year-month-day). It is worth noting that CTOD() doesn't care about current date delimiters specified by SET MARK TO or by the "International" page of the Options dialog, so CTOD("9/24/96"), CTOD("9-24-96") and CTOD("9.24.96") all work equally well.

Internationalization gotcha: If your date format doesn't match SET DATE, no error is generated, and a blank date value ( / / ) results.

Internationalization gotcha: Arguments passed to CTOD() are unaffected by SET MARK TO."

José
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform