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,304
  • 9
  • 38
  • 66
Mohamad
  • 1,089
  • 4
  • 19
  • 37

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,231
  • 24
  • 32