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

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > Only the relative order of y,m,d is needed from shortdateformat. > So the actual number, 1,2 or 4 ys is not relevant. You are still thinking > that it uses the actual dateformat, when it does not. Ah, I get it now! Sorry, I'm was a bit slow there. :

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

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > > It is mentioned in topic 'Date and time formatting characters' of the FPC > docs. I blame my mistake on the broken IPF output generated from 'fpdoc'. My new INF help viewer, 'docview', did not find any help on "formatting characters", so I thought i

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

2009-10-20 Thread Michael Van Canneyt
On Tue, 20 Oct 2009, Graeme Geldenhuys wrote: On 20/10/2009, Graeme Geldenhuys wrote: PS: Oh and a nice hidden little features (I couldn't find documentation for). When you specify a date format as '/mm/dd' or dd/mm/yy etc... The '/' character is NOT the separator! Correction, tha

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

2009-10-20 Thread Michael Van Canneyt
On Tue, 20 Oct 2009, Graeme Geldenhuys wrote: On 20/10/2009, Michael Van Canneyt wrote: - Call StrToDate to parse a string that specifies a date. If S does [...] First lines say it all. "dd/mm/yyy hh:nn" is not supposed t

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

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Graeme Geldenhuys wrote: > PS: > Oh and a nice hidden little features (I couldn't find documentation > for). When you specify a date format as '/mm/dd' or dd/mm/yy > etc... The '/' character is NOT the separator! Correction, that applies to FormateDateTime(), not StrToDate

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

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > > The error is correct, since 05/05/1999 is not a valid date. > It should use - instead of / . I've adapted the example. But couldn't you simply have forced DateSeparator to "-". Also could we try not to have such an obscure example - using day and

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

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > - > Call StrToDate to parse a string that specifies a date. If S does [...] > First lines say it all. "dd/mm/yyy hh:nn" is not supposed to work. That's up for discussion! :-) It says t

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

2009-10-20 Thread Michael Van Canneyt
On Tue, 20 Oct 2009, Graeme Geldenhuys wrote: On 20/10/2009, Michael Van Canneyt wrote: It is documented: and the documented example "ex19.pp" causes the same error! -- $ cp /opt/fpcdocs_svn/sysutex/ex19.pp ex19.pas $ fpc ex19.pas Free Pascal Compiler version 2.3

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

2009-10-20 Thread Michael Van Canneyt
On Tue, 20 Oct 2009, Graeme Geldenhuys wrote: On 20/10/2009, Michael Van Canneyt wrote: Strip the time part. You are feeding a date/time pair to something that expects ONLY a date. Surely it must be able to handle that? Delphi does. Extract what it needs and leave/ignore the rest?

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

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > > Strip the time part. > > You are feeding a date/time pair to something that expects ONLY a date. Surely it must be able to handle that? Delphi does. Extract what it needs and leave/ignore the rest? -- Regards, - Graeme -

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

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > > It is documented: and the documented example "ex19.pp" causes the same error! -- $ cp /opt/fpcdocs_svn/sysutex/ex19.pp ex19.pas $ fpc ex19.pas Free Pascal Compiler version 2.3.1 [2009/10/08] for x86_64 Copyright (c) 1993-2009

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

2009-10-20 Thread Michael Van Canneyt
On Tue, 20 Oct 2009, Graeme Geldenhuys wrote: On 20/10/2009, Michael Van Canneyt > 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

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

2009-10-20 Thread Michael Van Canneyt
On Tue, 20 Oct 2009, Graeme Geldenhuys wrote: On 20/10/2009, Michael Van Canneyt wrote: You make a common assumption, which is mistaken: StrToDate(DateToStr(date)) generally does not work. Crap! And that is pretty much what the tiOPF unit test is testing for. So why is StrToDate() so

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

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt > > 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 DateSepar

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

2009-10-20 Thread Graeme Geldenhuys
On 20/10/2009, Michael Van Canneyt wrote: > > You make a common assumption, which is mistaken: > StrToDate(DateToStr(date)) generally does not work. Crap! And that is pretty much what the tiOPF unit test is testing for. So why is StrToDate() so different to Delphi? In Delphi, the above mentio

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

2009-10-20 Thread Michael Van Canneyt
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 sh

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

2009-10-20 Thread Graeme Geldenhuys
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? --- program project1; {$mode objfpc}{$H+} uses {$IFDEF UNIX}{$IFDE