System.DateUtils.WeekOf

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function WeekOf(const AValue: TDateTime): Word;

C++

extern DELPHI_PACKAGE System::Word __fastcall WeekOf(const System::TDateTime AValue);

Properties

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

Description

Returns the week of the year represented by a TDateTime value.

Call WeekOf to obtain the week of the year represented by a specified TDateTime value. WeekOf returns a value from 1 through 53.

WeekOf uses the ISO 8601 standard to define the week of the year. That is, a week is defined as running from Monday through Sunday, and the first week of the year is the one that includes the first Thursday of the year (the first week that includes four or more days in the year). This means that if the first calendar day of the year is a Friday, Saturday, or Sunday, then for the first three, two, or one days of the calendar year, WeekOf returns the last week of the previous year. Similarly, if the last calendar day of the year is a Monday, Tuesday, or Wednesday, then for the last one, two, or three days of the calendar year, WeekOf returns 1 (the first week of the next calendar year).

Note: WeekOf returns the same value as the WeekOfTheYear function.

See Also


Code Examples