[fpc-pascal] Why has StrToDate() failing under FPC 2.3.1 (64bit)

Michael Van Canneyt michael at freepascal.org
Tue Oct 20 11:25:46 CEST 2009



On Tue, 20 Oct 2009, Graeme Geldenhuys wrote:

> Compiling the project works fine under FPC 2.3.1 (linux 64bit), but
> running it, i get a EConvertError and I don't know why.
>
> I am telling sysutils what LongDateFormat is like, but it still fails.
> Any ideas?

It is documented:

1. StrToDate uses shortdateformat.

2. StrToDate DOES NOT use shortdateformat to check the actual format;
    because it accepts only dates of the form N1/N2/N3
    - it uses ShortDateFormat ONLY to determine the order of y,m,d
    - it uses DateSeparator to determine the actual date separator to use instead of /

You make a common assumption, which is mistaken:
StrToDate(DateToStr(date)) generally does not work.

Michael.



More information about the fpc-pascal mailing list