|
|
|
|
|
- Default week characteristics
- Characteristics of the weeks according to the ISO 8601 standard
WeekNumber (Function) In french: NuméroDeSemaine Returns the week number within the year that corresponds to the specified date.
WeekNumber("20010818")
WeekNumber("20010210")
WeekNumber("20081223")
WeekNumber("20081229")
WeekNumber("20100101")
WeekNumber("20100104")
Syntax
<Result> = WeekNumber(<Date> [, <Format>])
<Result>: Integer Week number (between 0 and 53) that corresponds to the specified date. <Date>: Character string, 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).
- a character string in YYYYMMDDHHmmSSCC format (YYYY corresponds to the year, MM to the month, DD to the day, HH to hours, mm to minutes, SS to seconds and CC to hundredths of a second (use CCC for thousandths of a second)). In this case, only the date is taken into account.
- a Date variable.
- a DateTime variable. In this case, only the date is taken into account.
<Format>: Optional Integer constant Format used to calculate the week number. - By default, the week number returned corresponds to the default calculation mode.
- To use another format, use the following constant:
| | iso8601 | The returned week number complies with the ISO 8601 standard. New in version 2025 This constant is now available in browser code.    This constant is not available. |
Remarks Default week characteristics A week 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. 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 between Sunday of the 52nd week and the 1st of January are in week 53.
You cannot calculate the week number for a date before October 14, 1582. Characteristics of the weeks according to the ISO 8601 standard A week starts on a Monday and ends on a Sunday. For the first days of the year: - Week #1 is the week that contains the first Thursday of the year.
- 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. It systematically contains the first working day of the year, considering that the 1st of January, the Saturdays and the Sundays are non-working 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 week 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 first days of week #1 may be included at the end of December of the previous year. Similarly, the last days of the last week (52 or 53) of a year can appear 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.
|
Business / UI classification: Neutral code
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|