System.DateUtils.WeeksBetween

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function WeeksBetween(const ANow, AThen: TDateTime): Integer;

C++

extern DELPHI_PACKAGE int __fastcall WeeksBetween(const System::TDateTime ANow, const System::TDateTime AThen);

Properties

Type Visibility Source Unit Parent
function public
System.DateUtils.pas
System.DateUtils.hpp
System.DateUtils System.DateUtils

Description

Returns the number of whole weeks between two specified TDateTime values.

Call WeeksBetween to obtain the difference, in weeks, between two TDateTime values. WeeksBetween counts only whole Weeks. Thus, WeeksBetween reports the difference between January 1 at 12:00 A.M. and Jan 6 at 11:58 P.M. as 0, because the difference is one minute short of an entire week.

WeeksBetween always returns a positive result and therefore the parameter values are interchangeable.

See Also


Code Examples