help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Procedures and functions] Reference for unit 'dateutils' (#rtl)

SameTime

Check whether two TDateTime values have the same time part.

Declaration

Source position: dateutil.inc line 356

function SameTime(

  const A: TDateTime;

  const B: TDateTime

):Boolean;

Arguments

A

  

First DateTime value

B

  

Second DateTime value

Function result

True if A and B have the same time part, False if not.

Description

SameTime compares the time parts of two timestamps A and B and returns True if they are equal, False if they are not.

The function simply checks whether CompareTime returns zero.

See also

CompareDateTime

  

Compare 2 dates, taking into account the time of day

CompareDate

  

Compare 2 dates, disregarding the time of day

CompareTime

  

Compares two times of the day, disregarding the date part.

SameDateTime

  

Check whether two TDateTime values have the same date and time parts.

SameDate

  

Check whether two TDateTime values have the same date part.

Example

Program Example102;

{ This program demonstrates the SameTime 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 time as ');
  Writeln(FormatDateTime(Fmt,D2),' : ',SameTime(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.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505