help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



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

WeekOfTheMonth

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

Declaration

Source position: line 0

function WeekOfTheMonth(

  const AValue: TDateTime

):Word; overload;

function WeekOfTheMonth(

  const AValue: TDateTime;

  var AYear: Word;

  var AMonth: Word

):Word; overload;

Arguments

AValue

  

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

Function result

Week of the month

Arguments

AValue

  

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

AYear

  

Year part of AValue

AMonth

  

Month part of AValue

Function result

Week of the month

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 DateTime indication.

DayOfTheMonth

  

Extract the day (of month) part of a DateTime 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.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505