| [Overview][Constants][Procedures and functions][Index] | 
Check whether two TDateTime values have the same date part.
Source position: dateutil.inc line 365
| function SameDate( | 
| const A: TDateTime; | 
| const B: TDateTime | 
| ):Boolean; | 
| A | 
 | First DateTime value | 
| B | 
 | Second DateTime value | 
True if A and B have the same time part, False if not
SameDate compares the date parts of two timestamps A and B and returns True if they are equal, False if they are not.
The function simply checks whether CompareDate returns zero.
| 
 | Compare 2 dates, taking into account the time of day | |
| 
 | Compare 2 dates, disregarding the time of day | |
| 
 | Compares two times of the day, disregarding the date part. | |
| 
 | Check whether two TDateTime values have the same date and time parts. | |
| 
 | Check whether two TDateTime values have the same time part. | 
Program Example102; { This program demonstrates the SameDate function } Uses SysUtils,DateUtils; Const Fmt = 'dddd dd mmmm yyyy hh:nn:ss.zzz'; Procedure Test(D1,D2 : TDateTime); begin Write(FormatDateTime(Fmt,D1),' is the same date as '); Writeln(FormatDateTime(Fmt,D2),' : ',SameDate(D1,D2)); end; Var D,N : TDateTime; Begin D:=Today; N:=Now; Test(D,D); Test(N,N); Test(N+1,N); Test(N-1,N); Test(N+OneSecond,N); Test(N-OneSecond,N); End.