DateGetWeekOfYear_WDS
See Also: Time and Date Functions
Purpose
DateGetWeekOfYear_WDS (WDS = week day start) is a lower-level version of DateGetWeekOfYear that returns the week of the year for the passed DateTime value and starting week day.
This function uses a counting mechanism where the week that contains January 1 is always considered the first week of the year.
You should rarely need to use this function, as DateGetWeekOfYear (which starts on Sunday) and DateGetWeekOfYearISO (which starts on Monday and has a more complex set of rules) are the two main methods used for counting the week of the year.
- DateGetWeekOfYear uses Sunday as the first day of the week.
- DateGetWeekOfYearISO uses Monday as the first day of the week.
Note that passing 1 as iWeekDayStart makes this behave the same as DateGetWeekOfYear, and passing 2 as iWeekDayStart makes this behave the same as DateGetOfWeekISO. Since these are the two main standards, you should rarely need to use this function.
Return Type
Syntax
Use GlobalDateTimeFunctions.pkg
DateGetWeekOfYear_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 week of the year 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 week of the year is: " (DateGetWeekOfYear_WDS(dtVar, 2))
End_Procedure