John

the problem is that the "spelled" date formats
work for output, but not for input.    On input the
d/m/y  ordering is still in effect, but the input
expected is numeric (even for the month)

there is a pretty good discussion of this (and delphi
date stuff in general) here
http://www.aimtec.com.au/articles/ItsAboutTime/Default.htm

-ns

-----Original Message-----
From: John Christenhusz <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Thursday, October 26, 2000 02:16
Subject: [DUG]: StrToDate - DateToStr


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