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

WeekOfTheMonth

Extract the week of the month (and optionally month and year) from a TDateTime value

Declaration

Source position: dateutil.inc line 202

function WeekOfTheMonth(

  const AValue: TDateTime

):Word; overload;

function WeekOfTheMonth(

  const AValue: TDateTime;

  out AYear: Word;

  out AMonth: Word

):Word; overload;

Arguments

AValue

  

TDateTime value of which to calculate the week, month and year.

Function result

Week of the month

Arguments

AValue

  

TDateTime value of which to calculate the week, month and year.

AYear

  

Year part of AValue

AMonth

  

Month part of AValue

Description

WeekOfTheMonth extracts the week of the month from Avalue and returns it, and optionally returns the year and month as well (in AYear, AMonth respectively).

Remark: 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 and month 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

WeekOfTheYear

  

Extract the week of the year (and optionally year) of a TDateTime indication.

DayOfTheMonth

  

Extract the day (of month) part of a TDateTime value

HourOfTheMonth

  

Calculate the number of hours passed since the start of the month.

MinuteOfTheMonth

  

Calculate number of minutes elapsed since the start of the month.

SecondOfTheMonth

  

Calculate number of seconds elapsed since the start of the month.

MilliSecondOfTheMonth

  

Calculate number of milliseconds elapsed since the start of the month.

Example

Program Example41;

{ This program demonstrates the WeekOfTheMonth function }

Uses SysUtils,DateUtils;

Var
  N : TDateTime;

Begin
  N:=Now;
  Writeln('Week of the Month        : ',WeekOfTheMonth(N));
  Writeln('Day of the Month         : ',DayOfTheMonth(N));
  Writeln('Hour of the Month        : ',HourOfTheMonth(N));
  Writeln('Minute of the Month      : ',MinuteOfTheMonth(N));
  Writeln('Second of the Month      : ',SecondOfTheMonth(N));
  Writeln('MilliSecond of the Month : ',
          MilliSecondOfTheMonth(N));
End.

Documentation generated on: May 14 2021