Skip to content

DateGetDayOfWeekISO

See Also: Time and Date Functions

Purpose

DateGetDayOfWeekISO is an alternate version of DateGetDayofWeek that returns the day of the week of the given DateTime variable, dtVar, with Monday as the first day of the week.

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

Monday is considered the first day of the week according to the ISO 8601 standard (ISO week date). DateGetDayOfWeek always uses Sunday as the first day of the week.

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 always uses Sunday as the first day of the week. DateGetDayOfWeek_WDS allows you to specify the starting day of the week.

Return Type

Integer

Syntax

Use GlobalDateTimeFunctions.pkg
DateGetDayOfWeekISO({dtVar})

Where:

Example

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

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