[fpc-pascal] Is TryStrToDate works wrong?

Winfried Bartnick winni at bartnick.info
Sat Jan 4 18:31:37 CET 2020


Am 04.01.20 um 18:14 schrieb Michael Van Canneyt:
>
>
> On Sat, 4 Jan 2020, Gabor Boros wrote:
>
>> Hi All,
>>
>> var
>>   DT:TDateTime;
>>
>> begin
>>   Writeln(BoolToStr(TryStrToDate('1',DT),True));
>>
>>
>> The result of above code is "True" with FPC and "False" with Delphi.
>
> This is normal. FPC accepts more than Delphi, see the documentation:
>
> https://www.freepascal.org/docs-html/rtl/sysutils/strtodate.html
>
> Michael.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Hi!


The result is true, but the date is nonsense:

ShowMessage(BoolToStr(TryStrToDate('1',DT),True) + lineEnding + 
formatdatetime('dd.mm.yyyy',DT));

results in

/True//
/

/01.01.2020/


Not what I exspected.

Winni



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200104/68145a3b/attachment.html>


More information about the fpc-pascal mailing list