Skip to content

DateGetDayOfWeek

See Also: Time and Date Functions

Purpose

The DateGetDayOfWeek function returns the day of the week of the given DateTime variable, dtVar.

  • 1 = Sunday
  • 2 = Monday
  • 3 = Tuesday
  • 4 = Wednesday
  • 5 = Thursday
  • 6 = Friday
  • 7 = Saturday

The day of week calculation uses the Gregorian calendar, operating on a subset of the valid DateTime range, from year 0 to year 32767, where negative years are not supported.

DateGetDayOfWeek uses Sunday as the first day of the week. The function DateGetDayOfWeekISO uses Monday as the first day of the week. The function DateGetDayOfWeek_WDS allows you to specify the starting day of the week.

Return Type

Integer

Syntax

DateGetDayOfWeek({dtVar})

Where:

Example

This sample gets the day of the week (based on the starting day of the week being 1=Sunday).

Procedure Test
    DateTime dtVar
    // Get the current local date and time
    Move (CurrentDateTime()) to dtVar
    Showln "The day of week of " dtVar " is: " (DateGetDayOfWeek(dtVar))
End_Procedure