PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Default characteristics of the weeks
  • 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 number of the week corresponding to the specified date.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 16 and later
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This function is now available for the Windows Phone applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the 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.
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 QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppAjaxUser code (UMC)
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 QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppAjaxUser code (UMC)
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 QueriesiPhone/iPadWindows MobileUniversal Windows 10 AppAjaxUser code (UMC)
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
Number of the week (between 0 and 53) corresponding to the specified date.
<Date>: Character string (with quotes) or Date variable
Date in YYYYMMDD format.
<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 codeAndroidAndroid Widget Universal Windows 10 AppJavaPHP 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 codeAndroidAndroid Widget Universal Windows 10 AppJavaPHP 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 codeAndroidAndroid Widget Universal Windows 10 AppJavaPHP This parameter is not available.
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 later

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 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 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 17

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 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 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 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 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:
Management of dates Unit examples (WINDEV): Management of dates
[ + ] Using the Date type of WLanguage and the functions for handling dates.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230std.dll
Windows Mobile wp230std.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230std.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment