DayOfTheWeek

Extracts the day of the week from a TDateTime value

Declaration

Source position: dateutil.inc line 201

  function DayOfTheWeek(const AValue: TDateTime) : Word;

Description

DayOfTheWeek returns the number of days that have passed since the start of the week till the moment indicated by AValue. This is a one-based number, i.e. the first day of the week will return 1.

See also

Name Description
DayOfTheMonth Extract the day (of month) part of a TDateTime value
DayOfTheYear Extracts the day of the year from a TDateTime value
HourOfTheWeek Calculate the number of hours elapsed since the start of the week.
MilliSecondOfTheWeek Calculate the number of milliseconds elapsed since the start of the week
MinuteOfTheWeek Calculate the number of minutes elapsed since the start of the week
SecondOfTheWeek Calculate the number of seconds elapsed since the start of the week

Example

Program Example42;
{ This program demonstrates the WeekOfTheMonth function }
Uses SysUtils,DateUtils;
Var
  N : TDateTime;
Begin
  N:=Now;
  Writeln('Day of the Week         : ',DayOfTheWeek(N));
  Writeln('Hour of the Week        : ',HourOfTheWeek(N));
  Writeln('Minute of the Week      : ',MinuteOfTheWeek(N));
  Writeln('Second of the Week      : ',SecondOfTheWeek(N));
  Writeln('MilliSecond of the Week : ',
          MilliSecondOfTheWeek(N));
End.