[Overview][Constants][Procedures and functions][Index] | Reference for unit 'DateUtils' (#rtl)

# IsSameDay

Check if two date/time indications are the same day.

## Declaration

Source position: dateutil.inc line 126

`function IsSameDay(`
`const AValue: TDateTime;`
`const ABasis: TDateTime`
`):Boolean;`

## Arguments

`AValue` |  | First date/time
`ABasis` |  | Second date/time

## Function result

True if AValue and ABasis are on the same day, False otherwise..

## Description

IsSameDay checks whether AValue and ABasis have the same date part, and returns True if they do, False if not.

## See also

Today |  | Return the current date
Yesterday |  | Return the previous day.
Tomorrow |  | Return the next day
IsToday |  | Check whether a given date is today.

## Example

    Program Example21;

    { This program demonstrates the IsSameDay function }

    Uses SysUtils,DateUtils;

    Var
      I : Integer;
      D : TDateTime;

    Begin
      For I:=1 to 3 do
        begin
        D:=Today+Random(3)-1;
        Write(FormatDateTime('dd mmmm yyyy "is today : "',D));
        Writeln(IsSameDay(D,Today));
        end;
    End.

Documentation generated on: May 14 2021