WeekOfTheYear function
Extract the week of the year (and optionally year) of a TDateTime indication.
Declaration
function WeekOfTheYear(const AValue: TDateTime): Word; overloadArguments
AValue | Date from which to extract week. |
Function result
Week of the year in which
Avalue falls.
Description
WeekOfTheYear extracts the week of the year from
Avalue and
returns it, and optionally returns the year as well. It returns the same value as
WeekOf.
Note that weeks are numbered from 1 using the ISO 8601 standard, and the day
of the week as well. This means that the year may not be the same as the year
part of the date, since the week may start in the previous year as the first week
of the year is the week with at least 4 days in it.
See also
Example: ex40
Program Example40;
{ This program demonstrates the WeekOfTheYear function }
Uses SysUtils,DateUtils;
Var
N : TDateTime;
Begin
N:=Now;
Writeln('Month of the year : ',MonthOfTheYear(N));
Writeln('Week of the year : ',WeekOfTheYear(N));
Writeln('Day of the year : ',DayOfTheYear(N));
Writeln('Hour of the year : ',HourOfTheYear(N));
Writeln('Minute of the year : ',MinuteOfTheYear(N));
Writeln('Second of the year : ',SecondOfTheYear(N));
Writeln('MilliSecond of the year : ',
MilliSecondOfTheYear(N));
End.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
