 Default characteristics of the weeks
 Characteristics of the weeks according to the ISO 8601 standard
WeekNumber (Function) In french: NuméroDeSemaine Returns the number of the week corresponding to the specified date.
WeekNumber("20010818") // Returns 33 WeekNumber("20010210") // Returns 6 // Special cases for weeks 53 and 0 WeekNumber("20081223") // Returns 52: Tuesday December 23 2008 WeekNumber("20081229") // Returns 53: Monday December 29 2008 WeekNumber("20100101") // Returns 0: Friday January 1 2010 WeekNumber("20100104") // Returns 1: Monday January 4 2010
Versions 17 and later New in version 17 Syntax
<Result> = WeekNumber(<Date>)
<Result>: Integer Number of the week (between 0 and 53) corresponding to the specified date. <Date>: Character string (with quotes), Date or DateTime variable Date to use. This date can correspond to:  a character string in YYYYMMDD format (YYYY corresponds to the year, MM to the month and DD to the day).
Versions 24 and latera character string in YYYYMMDDHHMMSSCC format (YYYY corresponds to year, MM to month, DD to day, HH to hour, MM to minutes, SS to seconds and CC to hundredths of a second (use CCC for milliseconds). In this case, only the date is taken into account. New in version 24a character string in YYYYMMDDHHMMSSCC format (YYYY corresponds to year, MM to month, DD to day, HH to hour, MM to minutes, SS to seconds and CC to hundredths of a second (use CCC for milliseconds). In this case, only the date is taken into account. a character string in YYYYMMDDHHMMSSCC format (YYYY corresponds to year, MM to month, DD to day, HH to hour, MM to minutes, SS to seconds and CC to hundredths of a second (use CCC for milliseconds). In this case, only the date is taken into account.  a Date variable.
Versions 24 and latera DateTime variable. In this case, only the date is taken into account. New in version 24a DateTime variable. In this case, only the date is taken into account. a DateTime variable. In this case, only the date is taken into account.
Remarks Default characteristics of the weeks A weeks starts on a Monday and ends on a Sunday. For the first days of the year:  If the first day of the year is a Friday, Saturday or Sunday, the week number will be 0. The week #1 will correspond to the first Monday of the year.
 If the first day of the year is a Monday, Tuesday, Wednesday or Thursday, the week number will be 1.
 The days found between the Sunday of the 52nd week and January 1st are part of week 53.
You cannot calculate the week number for a date before October 14, 1582. Versions 17 and laterCharacteristics of the weeks according to the ISO 8601 standard A weeks starts on a Monday and ends on a Sunday. For the first days of the year:  The week #1 is the week that contains the first thursday of the year.
 The week #1 is the first week that contains most of its days (at least 4 days) in the year. It systematically contains the 4th of January. If systematically contains the first working day of the year, considering that the 1st of January, the Saturdays and the Sundays are nonworking days. It is the one whose Monday is nearest to the New Year's Day. It starts between the 29th of December and the 4th of January.
 The last week of the year (52 or 53) is the week that contains the last Thursday of the year. It is the last one to have most of its days (at least 4) in the year and it systematically contains the 28th of December. It is the one whose Sunday is nearest to the 31st of December. It ends between the 28th of December and the 3rd of January.
 There is no week zero (the week #1 of a year immediately follows the last week of the previous year).
 The last days of week #1 can eventually be included at the end of December of the previous year. Similarly, the firs days of the last week (52 or 53) of a year can be included at the beginning of the next year. A year always contains 52 or 53 weeks.
You cannot calculate the week number for a date before October 14, 1582. New in version 17Characteristics of the weeks according to the ISO 8601 standard A weeks starts on a Monday and ends on a Sunday. For the first days of the year:  The week #1 is the week that contains the first thursday of the year.
 The week #1 is the first week that contains most of its days (at least 4 days) in the year. It systematically contains the 4th of January. If systematically contains the first working day of the year, considering that the 1st of January, the Saturdays and the Sundays are nonworking days. It is the one whose Monday is nearest to the New Year's Day. It starts between the 29th of December and the 4th of January.
 The last week of the year (52 or 53) is the week that contains the last Thursday of the year. It is the last one to have most of its days (at least 4) in the year and it systematically contains the 28th of December. It is the one whose Sunday is nearest to the 31st of December. It ends between the 28th of December and the 3rd of January.
 There is no week zero (the week #1 of a year immediately follows the last week of the previous year).
 The last days of week #1 can eventually be included at the end of December of the previous year. Similarly, the firs days of the last week (52 or 53) of a year can be included at the beginning of the next year. A year always contains 52 or 53 weeks.
You cannot calculate the week number for a date before October 14, 1582. Characteristics of the weeks according to the ISO 8601 standard A weeks starts on a Monday and ends on a Sunday. For the first days of the year:  The week #1 is the week that contains the first thursday of the year.
 The week #1 is the first week that contains most of its days (at least 4 days) in the year. It systematically contains the 4th of January. If systematically contains the first working day of the year, considering that the 1st of January, the Saturdays and the Sundays are nonworking days. It is the one whose Monday is nearest to the New Year's Day. It starts between the 29th of December and the 4th of January.
 The last week of the year (52 or 53) is the week that contains the last Thursday of the year. It is the last one to have most of its days (at least 4) in the year and it systematically contains the 28th of December. It is the one whose Sunday is nearest to the 31st of December. It ends between the 28th of December and the 3rd of January.
 There is no week zero (the week #1 of a year immediately follows the last week of the previous year).
 The last days of week #1 can eventually be included at the end of December of the previous year. Similarly, the firs days of the last week (52 or 53) of a year can be included at the beginning of the next year. A year always contains 52 or 53 weeks.
You cannot calculate the week number for a date before October 14, 1582.
Related Examples:

Unit examples (WINDEV): Management of dates
[ + ] Using the Date type of WLanguage and the functions for handling dates.

This page is also available for…


