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
Syntax
Use GlobalDateTimeFunctions.pkg
DateGetDayOfWeek_WDS({dtVar}, {iWeekDayStart})
Where:
{dtVar}is a value of type DateTime.{iWeekDayStart}may be a value from1to7, where:1= Sunday2= Monday3= Tuesday4= Wednesday5= Thursday6= Friday7= 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