Recent

Author Topic: Extracting time values from TDateTime value  (Read 5149 times)

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Extracting time values from TDateTime value
« Reply #30 on: April 07, 2020, 09:51:43 am »
In fact, the "OffsetDay" is one day earlier, Dec 30, 1899. I never understood why it was selected like that.

Oops - remembered wrong date. Thanx!

Perhaps the Dec 30, 1899 was the Birthday of the grandpa of Anders Hejlsberg?
You'll never know.

The base date for TDateTime is based on the one used by Visual Basic (as this is also used for OLE datetimes) which in turn is based on Excel which in turn is based on Lotus 123. See here.

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
Re: Extracting time values from TDateTime value
« Reply #31 on: April 07, 2020, 10:25:40 am »
Perhaps the Dec 30, 1899 was the Birthday of the grandpa of Anders Hejlsberg?
You'll never know.

This date was the birthday of Helge Ingstad, a Norwegian explorer who made interesting discoveries and who was one of the very few persons to live in three centuries. See http://www.nfb.ca/film/man_discovered_america/.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Extracting time values from TDateTime value
« Reply #32 on: April 07, 2020, 11:01:12 am »

The base date for TDateTime is based on the one used by Visual Basic (as this is also used for OLE datetimes) which in turn is based on Excel which in turn is based on Lotus 123. See here.

It is assumed that Lotus 123 had "forgotten" that 1900 was not a leap year and so produced that date.

M$ also had to learn about the rules  for leap years: In some apps like Excel they forgot the 29th February 2000.

Winni

wp

  • Hero Member
  • *****
  • Posts: 11857
Re: Extracting time values from TDateTime value
« Reply #33 on: April 07, 2020, 12:15:25 pm »
Are you sure? See cell A2 (Excel 2016 and 97)

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Extracting time values from TDateTime value
« Reply #34 on: April 07, 2020, 02:06:53 pm »
@wp

Hi!

Sorry - are you kidding?
20 years is even for M$ enough to fix that bug.

And indeed they fixed that bug in December 1999 or January 2000.
Meanwhile we "parked" all the data for the 29th February on the first of May.

Winni

 

TinyPortal © 2005-2018