DateGetWeekOfYearISO
See Also: Time and Date Functions
Purpose
DateGetWeekOfYearISO is an alternate version of DateGetWeekOfYear that returns the week of the year for the given DateTime variable, dtVar. This function uses a counting mechanism where the first week of the year is defined as the first week that contains four days (i.e., the week that contains the first Thursday in the new year), and the start of the week is Monday. This is commonly used in Europe.
This mechanism means that January 1 may be considered part of the last week of the previous year, or December 31 may be considered part of the first week of the new year. Because of this, you may also need to know which year your week is part of. You can use the DateGetYearOfWeekISO function to retrieve the year.
The days of the week are represented as follows: - 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).
In contrast, DateGetWeekOfYear always uses Sunday as the first day of the week, and January 1 is always in the first week. DateGetWeekOfYear_WDS allows you to specify the starting day of the week.
Return Type
Syntax
Use GlobalDateTimeFunctions.pkg
DateGetWeekOfYearISO({dtVar})
Where:
- {dtVar} is a value of type DateTime.
Example
This sample gets the week of the year (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 week of the year is: " (DateGetWeekOfYearISO(dtVar))
End_Procedure