Skip to content

DateGetDayOfWeek_WDS

See Also: Time and Date Functions

Purpose

DateGetDayOfWeek_WDS (WDS = week day start) is a lower-level version of DateGetDayOfWeek that returns the day of the week for the passed DateTime value and starting week day.

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. DateGetDayOfWeekISO uses Monday as the first day of the week. Note that passing 1 as iWeekDayStart makes this behave the same as DateGetDayOfWeek, and passing 2 as iWeekDayStart makes this behave the same as DateGetDayOfWeekISO. Since these are the two main standards, you should rarely need to use this function.

Return Type

Integer

Syntax

Use GlobalDateTimeFunctions.pkg
DateGetDayOfWeek_WDS({dtVar}, {iWeekDayStart})

Where:

  • {dtVar} is a value of type DateTime.
  • {iWeekDayStart} may be a value from 1 to 7, where:
  • 1 = Sunday
  • 2 = Monday
  • 3 = Tuesday
  • 4 = Wednesday
  • 5 = Thursday
  • 6 = Friday
  • 7 = Saturday

Example

This sample gets the day of the week based on the starting day of the week being 2 = Monday.

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