Re: [fpc-devel] MinDateTime is 100 AD ?

2007-07-02 Thread Daniël Mantione


Op Mon, 2 Jul 2007, schreef Joost van der Sluis:

> Hi all,
> 
> In sysstrh.inc MinDateTime is defined as follows:
> 
>   { For floattodatetime }
>   MinDateTime: TDateTime = -657434.0; { 01/01/0100 12:00:00.000 AM }
>   MaxDateTime: TDateTime =  2958465.9;{ 12/31/ 11:59:59.999 PM }
> 
> Why is that? Datetimes before 100AD works perfectly. Can I change it to
> 01/01/01 ? (Why does this restriction exist at all?!?)

Most probably year 2000 releated. To easy conversions from two digit days 
to four digit years, rules were introduced that years <100 need to be 
interpreted as a two digit years. I am 99% sure that these values have 
been designed with some of these rules in mind. I recommend against 
changing.

Daniël___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] MinDateTime is 100 AD ?

2007-07-02 Thread Joost van der Sluis
On Mon, 2007-07-02 at 22:25 +0200, Micha Nelissen wrote:
> Joost van der Sluis wrote:
> > I'll change it to 01/01/01. When it raises problems on windows, the db-
> > testsuite will detect that. 
> 
> Isn't 01/01/01 just as arbitrary ?

Yes, it is.

Joost.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] MinDateTime is 100 AD ?

2007-07-02 Thread Joost van der Sluis
On Mon, 2007-07-02 at 22:32 +0200, Vincent Snijders wrote:
> On Mon, 02 Jul 2007 22:21:22 +0200
> Joost van der Sluis <[EMAIL PROTECTED]> wrote:
> 
> > On Mon, 2007-07-02 at 22:07 +0200, Michael Van Canneyt wrote:
> > > 
> > > On Mon, 2 Jul 2007, Joost van der Sluis wrote:
> > > 
> > > > On Mon, 2007-07-02 at 21:48 +0200, Michael Van Canneyt wrote:
> > > > > 
> > > > > On Mon, 2 Jul 2007, Joost van der Sluis wrote:
> > > > > 
> > > > > > Hi all,
> > > > > > 
> > > > > > In sysstrh.inc MinDateTime is defined as follows:
> > > > > > 
> > > > > >   { For floattodatetime }
> > > > > >   MinDateTime: TDateTime = -657434.0; { 01/01/0100 12:00:00.000 
> > > > > > AM }
> > > > > >   MaxDateTime: TDateTime =  2958465.9;{ 12/31/ 11:59:59.999 
> > > > > > PM }
> > > > > > 
> > > > > > Why is that? Datetimes before 100AD works perfectly. Can I change 
> > > > > > it to
> > > > > > 01/01/01 ? (Why does this restriction exist at all?!?)
> > > > > 
> > > > > Delphi compatibility, probably. As far as I know, it's not used ?
> > > > 
> > > > It is used in cvarutil.VariantToDate and in sysstr.FloatTodateTime. 
> > > 
> > > Probably to avoid a conversion error ?
> > > Maybe some Microsoft thing, that's where TDateTime comes from ?
> > > 
> > > The reason is probably lost in the mists of time :-)
> > 
> > I'll change it to 01/01/01. When it raises problems on windows, the db-
> > testsuite will detect that. 
> 
> Just an idea, what happens if you assign '01/01/01' (the string) to a variant 
> and then assign the variant to a tdatetime?
> 
> Is it a date from the year 1901 or not?

It'll return 1901. If you supply '01/01/0001' it will return the year
0001 in fpc 2.1.4, and 1901 in fpc 2.0.4.

Joost.
ps: I meant 01/01/0001 for MinDateTime, offcourse.


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] MinDateTime is 100 AD ?

2007-07-02 Thread Micha Nelissen
Joost van der Sluis wrote:
> I'll change it to 01/01/01. When it raises problems on windows, the db-
> testsuite will detect that. 

Isn't 01/01/01 just as arbitrary ?

Micha
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] MinDateTime is 100 AD ?

2007-07-02 Thread Vincent Snijders
On Mon, 02 Jul 2007 22:21:22 +0200
Joost van der Sluis <[EMAIL PROTECTED]> wrote:

> On Mon, 2007-07-02 at 22:07 +0200, Michael Van Canneyt wrote:
> > 
> > On Mon, 2 Jul 2007, Joost van der Sluis wrote:
> > 
> > > On Mon, 2007-07-02 at 21:48 +0200, Michael Van Canneyt wrote:
> > > > 
> > > > On Mon, 2 Jul 2007, Joost van der Sluis wrote:
> > > > 
> > > > > Hi all,
> > > > > 
> > > > > In sysstrh.inc MinDateTime is defined as follows:
> > > > > 
> > > > >   { For floattodatetime }
> > > > >   MinDateTime: TDateTime = -657434.0; { 01/01/0100 12:00:00.000 
> > > > > AM }
> > > > >   MaxDateTime: TDateTime =  2958465.9;{ 12/31/ 11:59:59.999 
> > > > > PM }
> > > > > 
> > > > > Why is that? Datetimes before 100AD works perfectly. Can I change it 
> > > > > to
> > > > > 01/01/01 ? (Why does this restriction exist at all?!?)
> > > > 
> > > > Delphi compatibility, probably. As far as I know, it's not used ?
> > > 
> > > It is used in cvarutil.VariantToDate and in sysstr.FloatTodateTime. 
> > 
> > Probably to avoid a conversion error ?
> > Maybe some Microsoft thing, that's where TDateTime comes from ?
> > 
> > The reason is probably lost in the mists of time :-)
> 
> I'll change it to 01/01/01. When it raises problems on windows, the db-
> testsuite will detect that. 

Just an idea, what happens if you assign '01/01/01' (the string) to a variant 
and then assign the variant to a tdatetime?

Is it a date from the year 1901 or not?

Vincent
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] MinDateTime is 100 AD ?

2007-07-02 Thread Joost van der Sluis
On Mon, 2007-07-02 at 22:07 +0200, Michael Van Canneyt wrote:
> 
> On Mon, 2 Jul 2007, Joost van der Sluis wrote:
> 
> > On Mon, 2007-07-02 at 21:48 +0200, Michael Van Canneyt wrote:
> > > 
> > > On Mon, 2 Jul 2007, Joost van der Sluis wrote:
> > > 
> > > > Hi all,
> > > > 
> > > > In sysstrh.inc MinDateTime is defined as follows:
> > > > 
> > > >   { For floattodatetime }
> > > >   MinDateTime: TDateTime = -657434.0; { 01/01/0100 12:00:00.000 AM }
> > > >   MaxDateTime: TDateTime =  2958465.9;{ 12/31/ 11:59:59.999 PM }
> > > > 
> > > > Why is that? Datetimes before 100AD works perfectly. Can I change it to
> > > > 01/01/01 ? (Why does this restriction exist at all?!?)
> > > 
> > > Delphi compatibility, probably. As far as I know, it's not used ?
> > 
> > It is used in cvarutil.VariantToDate and in sysstr.FloatTodateTime. 
> 
> Probably to avoid a conversion error ?
> Maybe some Microsoft thing, that's where TDateTime comes from ?
> 
> The reason is probably lost in the mists of time :-)

I'll change it to 01/01/01. When it raises problems on windows, the db-
testsuite will detect that. 

Joost.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] MinDateTime is 100 AD ?

2007-07-02 Thread Michael Van Canneyt


On Mon, 2 Jul 2007, Joost van der Sluis wrote:

> On Mon, 2007-07-02 at 21:48 +0200, Michael Van Canneyt wrote:
> > 
> > On Mon, 2 Jul 2007, Joost van der Sluis wrote:
> > 
> > > Hi all,
> > > 
> > > In sysstrh.inc MinDateTime is defined as follows:
> > > 
> > >   { For floattodatetime }
> > >   MinDateTime: TDateTime = -657434.0; { 01/01/0100 12:00:00.000 AM }
> > >   MaxDateTime: TDateTime =  2958465.9;{ 12/31/ 11:59:59.999 PM }
> > > 
> > > Why is that? Datetimes before 100AD works perfectly. Can I change it to
> > > 01/01/01 ? (Why does this restriction exist at all?!?)
> > 
> > Delphi compatibility, probably. As far as I know, it's not used ?
> 
> It is used in cvarutil.VariantToDate and in sysstr.FloatTodateTime. 

Probably to avoid a conversion error ?
Maybe some Microsoft thing, that's where TDateTime comes from ?

The reason is probably lost in the mists of time :-)

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] MinDateTime is 100 AD ?

2007-07-02 Thread Joost van der Sluis
On Mon, 2007-07-02 at 21:48 +0200, Michael Van Canneyt wrote:
> 
> On Mon, 2 Jul 2007, Joost van der Sluis wrote:
> 
> > Hi all,
> > 
> > In sysstrh.inc MinDateTime is defined as follows:
> > 
> >   { For floattodatetime }
> >   MinDateTime: TDateTime = -657434.0; { 01/01/0100 12:00:00.000 AM }
> >   MaxDateTime: TDateTime =  2958465.9;{ 12/31/ 11:59:59.999 PM }
> > 
> > Why is that? Datetimes before 100AD works perfectly. Can I change it to
> > 01/01/01 ? (Why does this restriction exist at all?!?)
> 
> Delphi compatibility, probably. As far as I know, it's not used ?

It is used in cvarutil.VariantToDate and in sysstr.FloatTodateTime. 

Joost.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] MinDateTime is 100 AD ?

2007-07-02 Thread Michael Van Canneyt


On Mon, 2 Jul 2007, Joost van der Sluis wrote:

> Hi all,
> 
> In sysstrh.inc MinDateTime is defined as follows:
> 
>   { For floattodatetime }
>   MinDateTime: TDateTime = -657434.0; { 01/01/0100 12:00:00.000 AM }
>   MaxDateTime: TDateTime =  2958465.9;{ 12/31/ 11:59:59.999 PM }
> 
> Why is that? Datetimes before 100AD works perfectly. Can I change it to
> 01/01/01 ? (Why does this restriction exist at all?!?)

Delphi compatibility, probably. As far as I know, it's not used ?

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel