[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'sysutils' (#rtl)

# DayOfWeek

Returns the day of the week.

## Declaration

Source position: datih.inc line 127

`function DayOfWeek(`
`DateTime: TDateTime`
`):Integer;`

## Description

DayOfWeek returns the day of the week from DateTime. Sunday is counted as day 1, Saturday is counted as day 7. The result of DayOfWeek can serve as an index to the LongDayNames constant array, to retrieve the name of the day.

## Errors

None.

## See also

Date |  | Return the current date.
DateToStr |  | Converts a TDateTime value to a date string with a predefined format.

## Example

    Program Example8;

    { This program demonstrates the DayOfWeek function }

    Uses sysutils;

    Begin
      Writeln ('Today''s day is ',LongDayNames[DayOfWeek(Date)]);
    End.

Documentation generated on: May 14 2021