Thank you very much for this code. I included it in my datasession init code
after SET SYSFORMATS ON statement.
>You can set the appropriate SET DATE, but it does not always work, i.e. if the Windows short date is dd-MMM-yy (16-Oct-01) or if you make a custom date with the year in the middle (dd-yyyy-MM). You could handle it in the error handler, and set it if the error occurs, or set it up front as your set up the app environment.
>
>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
>ENDCASE
>RETURN
>
>
>
>
>>1. Convert SET SYSFORMATS settings to SET DATE settings:
>>issue a SET SYSFORMATS ON, determine date format, issue according SET DATE command.
>>Which is the simplest way to implement this ?
Andrus