Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread StrToDate strange results, possible bug?
Mon, Nov 19 2012 5:44 AMPermanent Link

Ivan Mihailov

See the following code:


var  TempDate:    DateTime;
     TempString:  String;


1.
FormatSettings.DateSeparator   := '.';
FormatSettings.ShortDateFormat := 'dd.MM.yyyy';

TempString := '23.07.2012';
TempDate := StrToDate(TempString);
ShowMessage(DateToStr(TempDate));  -->  NaN.NaN.NaN


2.
FormatSettings.DateSeparator   := '-';
FormatSettings.ShortDateFormat := 'dd-MM-yyyy';

TempString := '23-07-2012';
TempDate := StrToDate(TempString);
ShowMessage(DateToStr(TempDate));  -->  23-05--2013  



3.
FormatSettings.DateSeparator   := '/';
FormatSettings.ShortDateFormat := 'dd/MM/yyyy';

TempString := '23/07/2012';
TempDate := StrToDate(TempString);
ShowMessage(DateToStr(TempDate));  -->  23/07/2012


Only the third variant is ok

Ivan Mihailov
Mon, Nov 19 2012 3:34 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ivan,

<< See the following code: >>

Yes, the date-parsing is having issues with decimal separators that also
belong to floating-point numbers.  I'll have a fix for this in the next
build, which hopefully will be out in the next couple of days.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Image