Neville Cook
Neville Cook

Reputation: 1492

Delphi date comparison

What is the difference between the two functions "IsSameDay" and "SameDate" in the Delphi DateUtils library?

Upvotes: 3

Views: 3020

Answers (1)

Rob Kennedy
Rob Kennedy

Reputation: 163357

The start of the day before day zero is TDateTime(-1.0). Noon of that day is TDateTime(-1.5).

IsSameDay(-1.5, -1); // False
SameDate(-1.5, -1); // True

For positive dates, the functions are equivalent.

Upvotes: 7

Related Questions