PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Default week characteristics
  • Characteristics of the weeks according to the ISO 8601 standard
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Returns the week number within the year that corresponds to the specified date.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 26 and later
Apple Watch This function is now available for Apple Watch applications.
New in version 26
Apple Watch This function is now available for Apple Watch applications.
Apple Watch This function is now available for Apple Watch applications.
Example
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
WINDEVWEBDEV - Server codeReports and QueriesUniversal Windows 10 AppWindows MobileiPhone/iPadApple WatchUser code (UMC)Ajax
WeekNumber("20010818", iso8601)  // Returns 33
WeekNumber("20010210", iso8601)  // Returns 6
 
// Special case: weeks 53 and 1
WeekNumber("20081223", iso8601)  // Returns 52: Tuesday December 23 2008
WeekNumber("20081229", iso8601)  // Returns 1: Monday December 29 2008
WeekNumber("20100101", iso8601)  // Returns 53: Friday January 1 2010
WeekNumber("20100104", iso8601)  // Returns 1: Monday January 4 2010
New in version 17
WINDEVWEBDEV - Server codeReports and QueriesUniversal Windows 10 AppWindows MobileiPhone/iPadApple WatchUser code (UMC)Ajax
WeekNumber("20010818", iso8601)  // Returns 33
WeekNumber("20010210", iso8601)  // Returns 6
 
// Special case: weeks 53 and 1
WeekNumber("20081223", iso8601)  // Returns 52: Tuesday December 23 2008
WeekNumber("20081229", iso8601)  // Returns 1: Monday December 29 2008
WeekNumber("20100101", iso8601)  // Returns 53: Friday January 1 2010
WeekNumber("20100104", iso8601)  // Returns 1: Monday January 4 2010
WINDEVWEBDEV - Server codeReports and QueriesUniversal Windows 10 AppWindows MobileiPhone/iPadApple WatchUser code (UMC)Ajax
WeekNumber("20010818", iso8601)  // Returns 33
WeekNumber("20010210", iso8601)  // Returns 6
 
// Special case: weeks 53 and 1
WeekNumber("20081223", iso8601)  // Returns 52: Tuesday December 23 2008
WeekNumber("20081229", iso8601)  // Returns 1: Monday December 29 2008
WeekNumber("20100101", iso8601)  // Returns 53: Friday January 1 2010
WeekNumber("20100104", iso8601)  // Returns 1: Monday January 4 2010
Syntax
<Result> = WeekNumber(<Date> [, <Format>])
<Result>: Integer
Week number (between 0 and 53) that corresponds 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 later
    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.
    New in version 24
    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 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.
  • Versions 24 and later
    a DateTime variable. In this case, only the date is taken into account.
    New in version 24
    a 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.
<Format>: Optional Integer constant
Versions 17 and later
Format used to calculate the week number.
Versions 17 and later
iso8601
New in version 17
iso8601
iso8601
The returned week number complies with the ISO 8601 standard.
<Format> parameter not specifiedThe returned week number corresponds to the default calculation mode.

WEBDEV - Browser codeUniversal Windows 10 AppAndroidAndroid Widget JavaPHP This parameter is not available.
New in version 17
Format used to calculate the week number.
Versions 17 and later
iso8601
New in version 17
iso8601
iso8601
The returned week number complies with the ISO 8601 standard.
<Format> parameter not specifiedThe returned week number corresponds to the default calculation mode.

WEBDEV - Browser codeUniversal Windows 10 AppAndroidAndroid Widget JavaPHP This parameter is not available.
Format used to calculate the week number.
Versions 17 and later
iso8601
New in version 17
iso8601
iso8601
The returned week number complies with the ISO 8601 standard.
<Format> parameter not specifiedThe returned week number corresponds to the default calculation mode.

WEBDEV - Browser codeUniversal Windows 10 AppAndroidAndroid Widget JavaPHP This parameter 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.
Versions 17 and later

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.
New in version 17

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.

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:
Management of dates Unit examples (WINDEV): Management of dates
[ + ] Using the Date type of WLanguage and the functions for handling dates.
Business / UI classification: Neutral code
Component: wd260std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment