ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Date and time functions
  • 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/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Returns the date of the Monday for the specified week and year.
Example
dFirstMonday is Date
 
// First Monday of 2010: returns 20091228
dFirstMonday = WeekToDate(1, 2010)
// The week number complies with the iso8601 standard: returns 20091228
dFirstMonday = WeekToDate(1, 2010, iso8601)
 
// Monday of week 52 for the year 2008: returns 20081229
dFirstMonday = WeekToDate(52, 2008)
// The week number complies with the iso8601 standard: returns 20081222
dFirstMonday = WeekToDate(52, 2008, iso8601)
Syntax
<Result> = WeekToDate(<Week number> , <Year> [, <Type of week>])
<Result>: Character string or Date variable
Date corresponding to the Monday for the specified week and year.
<Week number>: Integer
Number of the week for which the date of Monday must be found. This parameter is between 0 and 53. If this number complies with the ISO 8601 standard, <Type of week> must correspond to the iso8601 constant.
<Year>: Integer
Year that will be used for the calculation.
<Type of week>: Optional integer constant
Type of the week number:
iso8601The week number passed as parameter complies with the ISO 8601 standard.
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.

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.
Business / UI classification: Neutral code
Component: wd290std.dll
Minimum version required
  • Version 18
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help