John,

short date format like 10/25/2000 works well with StrToDate.
I have tried using (-) as a date separator, but didn't work although it is a
valid separator(I don't know why).
Also, if you try the NZ date like 25/10/2000 wouldn't work either.

Cheers.

                Hi all,

                Who knows the answer to this simple problem?

                DateToStr(now) returns nicely the string equivalent for the
current date 
                using ShortDateFormat.

                StrToDate('<date string>') returns the TDateTime for the
given date string. 
                However, when you have the date time settings so that you
use e.g. 
                '25-Oct-2000', thus the ShortDateFormat = 'dd-MMM-yyyy' then
it falls over.

                The help on StrToDate says "ShortDateFormat global
variable--possible 
                combinations are m/d/y, d/m/y, and y/m/d".
                This implies (to my opinion) that StrToDate is not using the

                ShortDateFormat !

                Eg. (using ShortDateFormat = 'dd-MMM-yyyy' )
                        DateToStr(now) returns nicely '25-Oct-2000'
                but     StrToDate needs '25-10-2000'

                        and so StrToDate( DateToStr(now) ) does not work!!


                Has anybody any code to do a String-To-Date conversion using

                ShortDateFormat?


                Thanks a lot for any help.

                John.

        
---------------------------------------------------------------------------
                    New Zealand Delphi Users group - Delphi List -
[EMAIL PROTECTED]
                                  Website: http://www.delphi.org.nz
                To UnSub, send email to: [EMAIL PROTECTED] 
                with body of "unsubscribe delphi"

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to