0

Why is there a difference between the conversion of a date in Delphi and SQL Server with these commands:

SQL Server :

SELECT CAST(GETDATE() AS FLOAT)

Delphi :

writeln(floattostr(now));

Example: For today

SQL Server = 40871.431264506 
Delphi     = 40873.4333729861

Why are the two results different?

Josh Darnell
  • 11,096
  • 9
  • 36
  • 63
Mohamad
  • 1,080
  • 3
  • 18
  • 35

1 Answers1

4

Because many languages have different ways of dealing with dates internally. They may or may not store them internally as a float, and may also start counting at different "starting" dates. For instance, Delphi starts at 12/30/1899 (a TDateTime of 0).

See also this link.

Community
  • 1
  • 1
Nathanial Woolls
  • 5,201
  • 23
  • 31