Show: Delphi C++
Display Preferences

System.DateUtils.WeekOfTheYear

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function WeekOfTheYear(const AValue: TDateTime): Word;
function WeekOfTheYear(const AValue: TDateTime; var AYear: Word): Word;

C++

extern DELPHI_PACKAGE System::Word __fastcall WeekOfTheYear(const System::TDateTime AValue)/* overload */;

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 WeekOfTheYear to obtain the week of the year represented by a specified TDateTime value. WeekOfTheYear returns a value from 1 through 53.

AYear returns the year in which the specified week occurs. Note that this may not be the same as the year of AValue. This is because the first week of a year is defined as the first week with four or more days in that 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, WeekOfTheYear 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, WeekOfTheYear returns 1 (the first week of the next calendar year).

Note: WeekOfTheYear uses the ISO 8601 standard definition of a week. That is, a week is considered to start on a Monday and end on a Sunday.
Note: WeekOfTheYear returns the same value as the WeekOf function.

See Also


Code Examples

Personal tools
In Other Languages
Previous Versions
Assistance