Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Invalid date/datetime values in specific situation
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00598441
Message ID:
00599611
Views:
29
The only way is to put this code to datasession init:

From Jim Saunders #037016 Microsoft

* Here is an example that may serve to give you some ideas of how to
* implement this, which mostly works. I want to emphasize that I don't
* expect this to be foolproof in the form below.

LOCAL ldDate, lcDate
ldDate = {^2001-12-31}
lcDate = DTOC(ldDate)
DO CASE
CASE RIGHT(lcDate,IIF(SET("Century")='ON',4,2)) = ;
RIGHT(ALLTRIM(STR(YEAR(ldDate))),IIF(SET("Century")='ON',4,2)) ;
AND LEFT(lcDate,2) = ALLTRIM(STR(MONTH(ldDate)))
SET DATE MDY

CASE RIGHT(lcDate,IIF(SET("Century")='ON',4,2)) = ;
RIGHT(ALLTRIM(STR(YEAR(ldDate))),IIF(SET("Century")='ON',4,2)) ;
AND LEFT(lcDate,2) = ALLTRIM(STR(DAY(ldDate)))
SET DATE DMY

CASE LEFT(lcDate,IIF(SET("Century")='ON',4,2)) = ;
RIGHT(ALLTRIM(STR(YEAR(ldDate))),IIF(SET("Century")='ON',4,2)) ;
AND RIGHT(lcDate,2) = ALLTRIM(STR(DAY(ldDate)))
SET DATE YMD

OTHERWISE && Not sure what to do, date format is not recognized

ENDCASE

>>Can you just use another option for the 'Set Date', like DMY, MDY or USA? it will work with all date (from 01-01-0001)
>>
>>Hth
>
>Herman,
>
>I don't think that is an option for us right now, especially since we've used the SHORT setting for the past 4 years. The main reasoning behind this is that we didn't want to force the date format in our application for our international clients.
>
>For right now, it looks like we can trap the error in the containing form's error event. We'll probably do some more testing to see if this completely resolves our situation.
>
>Laterness,
>Jon
Andrus
Previous
Reply
Map
View

Click here to load this message in the networking platform