Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DATE BUG ????
Message
 
To
09/02/2000 23:58:43
Amit Abhangrao
Charmi Software Exports
Mumbai, India
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00329861
Message ID:
00329878
Views:
23
>Cut and paste the following code in prg and run the program and see the result.
>
>********************************************************************
>Clear
>set cent on
>Set Talk Off
>?"BUG ?????"
>?Set('Date')
>?
>lsErrMsg = " "
>Set Date Amer
>?"Date is set to American and trying to print {02/15/2000}"
>lsErrMsg = " "
>If Empty({02/15/2000})
> lsErrMsg = " Why Blank ????"
>EndIf
>? " Date(American) :- "+DTOC({02/15/2000})+ lsErrMsg
>?
>
>Set Date Brit
>?"Now the date is set to British and trying to print {15/02/2000}"
>lsErrMsg = " "
>If Empty({15/02/2000})
> lsErrMsg = " Why Blank ????"
>EndIf
>? " Date(British) :- "+ DTOC({15/02/2000})+ lsErrMsg
>?
>? "AND ALSO CHANGE THE PC DATE TO 15/02/2000 OR GREATER THAN 12"
>? "THIS ERROR WILL COME FOR DATE() FUNCTION ALSO"
>return
>*******************************************************************
>
>
>You will find that one of the date is showing EMPTY.
>1) Try SET DATE AMERICAN from command window, compile the prg and run.
> You will find the British date is comming Empty.
>
>2) Try SET DATE BRITISH from command window, compile the prg and run.
> This will show you the American formate date as blank.
>
>If you are using Date() Function, then also you will face the same prob. Write code for AMERICAN Date Type and compile file when Date is Set to BRITISH. Your whole program will give the wrong result. BE AWARE OF IT.
>
>Is foxpro writes the Date format, while compiling, in FXP file????
>
>
>Regards
>
>Charmi Software Exports

Two things here. First, force yourself to use the unambiguous date format, like {^2000/02/10} for today. Also be aware that DTOC is a dangerous beast. From help: "DTOC( ) returns a character string corresponding to a Date or DateTime expression. The date format is determined by SET CENTURY and SET DATE."

José
Previous
Reply
Map
View

Click here to load this message in the networking platform