Jump to content

Talk:ISO week date

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Nearly a B.

Want to help write or improve articles about Time? Join WikiProject Time or visit the Time Portal for a list of articles that need improving.
Yamara 18:18, 14 February 2008 (UTC)[reply]

Discussion

[edit]

Ok, I understand now "What if most years had a leap week?". What matters for the maximum change of corresponding equinoxes between two years is the largest deviation of a year from the average year.--Patrick 21:38, 30 May 2006 (UTC)[reply]

@Patrick 185.76.176.84 (talk) 02:38, 25 September 2024 (UTC)[reply]

Lede

[edit]

I would situate the following sentence at the beginning: The first week of a year is the week that contains the first Thursday of the year. It is also (equivalently) the week containing the 4th day of January.

Everybody looks for that information and has to read half a page to get to it.

Currently prior we talk about iso. Well, that´s scientific correct, but I think people look for a trivial explanation first and than for the scientific one. My opinion of course br hans.stangl@gmx.at --194.113.154.132 (talk) 08:15, 26 February 2014 (UTC)[reply]

Huh? It’s in the lede, after all, not buried in some section. Also, not every read of this article is primarily looking for that piece of information. Nevertheless, I rearranged and rephrased the introduction today and the Thursday rule moved up a bit. — Christoph Päper 20:10, 26 February 2014 (UTC)  Done[reply]
I wasn't looking for it, I was just reading generally about ISO 8601 to see whether it might be useful in a project. I found the first mention ("and, hence, 4 January") a bit too terse and not obvious just from reading it. I added always contains, which, for me, improves the readability, though one might quibble about redundancy. I also added a link to where it's explained for those with a similar "Eh?" response. 92.0.230.198 (talk) — Preceding undated comment added 13:14, 17 January 2015 (UTC)[reply]

Use of term "Leap Week"

[edit]

I have seen ISO 8601:2000 but not ISO 8601:2004. ISO 8601:2000 does not use the term "leap week"; I don't know whether ISO 8601:2004 does.

Unless the term is introduced in ISO 8601:2004, it seems to me unwise to introduce it elsewhere; "week 53" suffices. It leads to using "leap year" for 53-week years, which clashes with conventional use. It might be thought to mean a week containing February 29th.

Re section "Disadvantages" : The ISO Week Calendar could fully replace the Gregorian, because it is possible to calculate Day 1 of a given year directly - but the expression will be more complicated.

Re section "Advantages" : Although the date of Easter Sunday would be no easier to calculate, the number of possible dates would be less, since all are Day 7. Only a few Week Numbers would be possible. 82.163.24.100 13:45, 30 January 2007 (UTC)[reply]

Only six Week Numbers, 12-17 would be possible, 17 being rare. 82.163.24.100 22:19, 3 February 2007 (UTC)[reply]


ISO 8601:2004 does not use "leap week". It does use "leap year", but in the common sense of a year with 366 days; accordingly, "leap year" should not be used to refer to an ISO year of 53 weeks.

Library routines purporting to convert other forms of date into ISO week dates should be viewed with caution; errors are known to occur, for example with 2007-12-31.

There is only ONE definition of Week 01; it is in ISO 8601:2004 2.2.10, and uses 'first Thursday' (and see 3.2.2 note 3). The others are mere equivalent consequential descriptions.

82.163.24.100 10:52, 26 May 2007 (UTC)[reply]

 Done

The page now mostly uses long year to refer to years with 53 weeks. — Christoph Päper 18:22, 9 August 2010 (UTC)[reply]

2016-2017

[edit]

I stopped reading this article when I saw "leap week" followed by the comment that it isn't in the standard. It needs to be edited out or the article delelete completely - Wikipedia is not a place for original research or soapboxing.114.198.81.18 (talk) 09:41, 11 September 2016 (UTC)[reply]

Really? You could have just edited it (which I’ve done now instead) There were four instances of “leap week”, two of which did not specifically relate to ISO terminology. — Christoph Päper 07:56, 13 September 2016 (UTC)[reply]
I think the article should still mention that it is (effectively) a leap week calendar, but need not give it the prominence it currently enjoys. Karl (talk) 11:42, 13 September 2016 (UTC)[reply]
I stopped reading, had a quiet chuckle, thought "what a terrible article this is", came to the talk page to see if anyone else was of the same mind, wrote this, and left. That'll teach me to click on W***ypedia links. — Preceding unsigned comment added by 194.228.59.158 (talk) 22:35, 25 August 2017 (UTC)[reply]

Templates

[edit]
* [[Template:ISOWEEKDATE]] - {{evd|ISOWEEKDATE|2010|01|03}} The opposite function of {{tl|ISOWEEKDATE2YMD}}
:* [[Template:ISOYEAR]] - {{evd|ISOYEAR|2010|01|03}}
:* [[Template:ISOWEEK]] - {{evd|ISOWEEK|2010|01|03}}
:* [[Template:ISOWEEKDAY]] - {{evd|ISOWEEKDAY|2010|01|03}}
* [[Template:ISOWEEKDATE2YMD]] - {{evd|ISOWEEKDATE2YMD|2009|53|7}} The opposite function of {{tl|ISOWEEKDATE}}
:* [[Template:ISOWEEKDATE2Y]] - {{evd|ISOWEEKDATE2Y|2009|53|7}}
:* [[Template:ISOWEEKDATE2M]] - {{evd|ISOWEEKDATE2M|2009|53|7}}
:* [[Template:ISOWEEKDATE2D]] - {{evd|ISOWEEKDATE2D|2009|53|7}}
(unsigned date unknown)

Use the {{#time}} parser function instead. JIMp talk·cont 07:26, 1 June 2012 (UTC)[reply]

These are to be deleted. JIMp talk·cont 23:35, 4 June 2012 (UTC)[reply]

Disadvantage question

[edit]

I don't get this part: "It cannot replace the Gregorian calendar, because it relies on it to define the new year day (Week 1 Day 1)."

Is what you want to say that if it coexists with the Gregorian Calendar then it has to be decided which one of them that tells when to celebrate new year's eve since the days for a new year differs?

I can see no logical reason to why new year couldn't be defined as Week 1 Day 1. I mean it's pretty much how it is now with the leap days, we don't celebrate the new year on different times on the day even if it supposedly moves approx 6 hours each year.

--Crouz 20:50, 4 November 2007 (UTC)[reply]

The Gregorian 400-year cycle is necessary to decide which week and year number the first and last days of a year belong to. That means there is no simple algorithms that decides whether a week-year has a 53rd week based solely on the year number. — Christoph Päper 18:22, 9 August 2010 (UTC)[reply]

 Done

Poor wording (in the article, not yours). It's intended to co-exist with the Gregorian calendar rather than replace it. To decide whether the year has 53 weeks you refer to the Gregorian calendar. If we wanted to replace the Gregorian calendar, a simpler algorithm would be preferable. JIMp talk·cont 07:34, 1 June 2012 (UTC)[reply]

Algorithms

[edit]

Having seen the rubbishy code of two major software suppliers, and noting that the recent products of one have code which is not only bloated but wrong, I think that adding something on Algorithms would be justified.

To convert a Gregorian date into an ISO 8601 Week Numbering date Y W D, all that is necessary is to :-

 Determine its Day of Week, D
 Use that to move to the nearest Thursday (-3..+3 days)
 Note the year of that date, Y
 Obtain January 1 of that year
 Get the Ordinal Date of that Thursday, DDD of YYYY-DDD
 Then W is 1 + (DDD-1) div 7

or very similar.

Observe that there is no need to consider any special cases.

Here are well-tested Delphi routines for the comversions of a TDateTime (Local daycount from 1899-12-30 00:00:00 = 0.0) to and from Y W D form :-

procedure ISODTtoYWD(const DT : TDateTime ; out YN, WN, DN : word) ;
var X : word ; NThu, Jan1 : TDateTime ;
begin // The canonical version.
  DN := 1 + (DayOfWeek(DT)+5) mod 7 { DT : Mon=1 to Sun=7 } ;
  NThu := Trunc(DT) + 4 - DN { NThu is the Nearest Thursday } ;
  DecodeDate(NThu, YN, X, X) { get Year Number of NThu } ;
  Jan1 := EncodeDate(YN, 1, 1) { January 1 of YN } ;
  WN := 1 + Trunc(NThu-Jan1) div 7 { Count of Thursdays } ;
  end {ISODTtoYWD} ;
function ISOYWDtoDT(const YN, WN, DN : word) : TDateTime ;
var DT : TDateTime ; DW : integer ;
begin // The canonical version.
  DT := EncodeDate(YN, 1, 4) { YN Jan 4, which is in YN Week 1 } ;
  DW := 1 + (DayOfWeek(DT)+5) mod 7 { DT : Mon=1 to Sun=7 } ;
  DT := DT - DW { DT to day before Week 1 } ;
  Result := DT + (WN-1)*7 + DN { increment for Weeks and Days } ;
  end {ISOYWDtoDT} ;

A slight speed-up is possible, at the expense of clarity.

Javascript versions are in http://www.merlyn.demon.co.uk/weekcalc.htm .

82.163.24.100 (talk) 21:19, 19 March 2008 (UTC)[reply]

Here is a C# .NET implementation. I've tested it against all of the test cases, and it passes.

   public class ISO_Week {
       public int year;
       public int week;
       public int dayOfWeek;
       public ISO_Week(DateTime dt)
       {
           if (CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek != DayOfWeek.Monday) throw new NotImplementedException("This only works for cultures with Monday as the first day of the week.");  —Preceding unsigned comment added by 194.28.249.49 (talk) 06:29, 20 April 2011 (UTC) 
           dayOfWeek = 1 + ((int)dt.DayOfWeek + 1+5) % 7; // Mon=1 to Sun=7
           DateTime NearestThu = dt.AddDays(4 - dayOfWeek);
           year = NearestThu.Year;
           DateTime Jan1 = new DateTime(year, 1, 1);
           TimeSpan ts = NearestThu.Subtract(Jan1);
           week = 1 + ts.Days / 7; // Count of Thursdays 
       }
   }[reply]

--19:51, 24 February 2010 71.141.227.160

How can this algorithm be correct? It has the same problem that the algorithm in the page has, and that is it doesn't handle the case of wrapping the weeks at year beginning and year end. If you put in a date of Jan 1, and that day falls on Friday, for example, the answer will not be 0 or 1, it will be 53. How can those calculations produce that result? Kenbkop — Preceding undated comment added 01:23, 16 December 2023 (UTC)[reply]
I'm not sure I understand this algorithm. Take today's date, Wednesday 18 May 2011. The nearest Thursday is 19 May 2011. 1 January 2011 was a Saturday, and the Thursday of that week was 30 December 2010, ordinal day 364. Then W = 1 + (363 div 7) equals 52. But that can't be right. What am I doing wrong? AD ASTRA SCIENTIA (talk) 02:25, 19 May 2011 (UTC)[reply]
The year of Thursday 19 May 2011 is 2011. In 2011, 19 May is ordinal day 139. The week is 1+(139-1)/7=20 . −Woodstone (talk) 03:40, 19 May 2011 (UTC)[reply]



Using calculations based on a linear scale like the Rata Die number can be more useful in programming. If we want to calculate the Rata Die of a ISO week date we can use the relation to the Gregorian calendar and write the following Python code:

   def isocal_date2rdn2(y,w,d):
       y -= 1
       ew = (y*365 + y//4 - y//100 + y//400 + 3) // 7
       return (ew + w - 1) * 7 + d

Here y, w, d are year, week and day-of-week of the ISO week calendar date. It is important to understand that Python's '//' operator implements floor division, which is important if one of the quantities involved leaves the nominal range and becomes negative.

The algorithm is rather simple: It uses the Gregorian calendar to get the number of days elapsed since the begin of the Christian Era (0001-01-01) and converts this number in a rounding manner to the number of elapsed weeks ('ew') for the begin of the year in the ISO week calendar. Then it adds the number of elapsed weeks in the year and uses the total number of elapsed weeks and the day-of-week to get the Rata Die of the ISO week date.

The reverse operation is a bit more tricky and is based on extensive exploration of the tabulated elapsed weeks for every year of a 400-year cycle. It can be shown that for every century it's possible to plot a cohort of straight lines through the tabulated data in such manner that every line of the cohort is always above the tabulated data and that the difference between the line and the data is always less than 1. Then the conversion from elapsed weeks since begin of a century to the number of elapsed years can be done with a linear transformation of the form

ey = floor(ew * a + b).

Since there is a cohort of possible slopes, one can find integer coefficients a, b and k where

ey = (ew * a + b) // k

'//' again denoting integer floor division. It can further be shown that there is a cohort of slopes common to all 4 centuries. This results in common values for a and k, but the additive constant b has to be chosen differently for every century.

Another observation is that the first, third and last century of a cycle have 5218 weeks, and the the second century has only 5217 weeks. If we apply the proper correction for weeks >= 10435, we can get the elapsed centuries and the weeks in the century through division by 5218.

Plumbing this all together, we yield the following Python code:

   # selected values: a=28 k=1461 b=[15,23,3,11]
   def isocal_rdn2date1(rdn):
       w,d = divmod(rdn-1, 7)
       n,w = divmod(w, 20871) # weeks in 400 years
       c,w = divmod(w + (w >= 10435), 5218) # get century and weeks in century
       y,w = divmod(w * 28 + (15,23,3,11)[c], 1461) # get years in century and scaled weeks in year
       return (n*400 + c*100 + y + 1, (w // 28) + 1, d + 1) # get y,w,d in ISO week calendar

There are of course many coefficient sets for a, k, b0..b3 that yield the desired result; a=157 k=8192 b=[85,131,17,62] has the advantage that the division and modulo operation can be carried out by shift and mask operations in languages like C.

j.perlinger (perlinger-at-ntp-dot-org) 217.81.188.179 (talk) 00:59, 9 December 2011 (UTC)[reply]

logic error found

[edit]

The definition of the first week in the iso calendar mentions:

Mutually equivalent definitions for week 01 are:

  • the week with the year's first Thursday in it
  • the week with January 4 in it

However this cannot be true, for in 2009 they fall on different weeks:

  January 2009
 S  M Tu  W Th  F  S
             1  2  3
 4  5  6  7  8  9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

—Preceding unsigned comment added by 192.65.45.20 (talkcontribs)

As mentioned, in this system weeks start with Monday.--Patrick (talk) 23:51, 6 June 2008 (UTC)[reply]

 Done

And if you use a US week calendar where Sunday id the first day of the week, the definition of the week number is one of the two equivalent statements:
  • the week with January 4 in it (unaffected statement)
  • the week with the year's first Wednesday in it
The choice of Thursday in the ISO week calendar comes from the definition where weeks start by Monday (this is the case in most countries): the first Thursday is used because there may be 3 days before and 3 days after it in the ISO week
  • If you use an Jewish calendar with weeks starting on Saturday, week 1 will include the year's first Tuesday, but wil also include January 4
  • If you use an Islamic calendar with weeks starting on Friday, week 1 will include the year's first Monday, but will also include January 4
After that there are still variants about how to count the days taken from the end of the previous year: they could be counted either into week 1 of the new year, or counted as days in an incomplete week ending the last year leaving week 1 of the new year also incomplete.
Other definitions consider week 1 to be the first complete year fully in the year, leaving up to 6 days in the last year (or counting them in week "0" of the new year): such definitions say that week 1 includes January 7 (or equivalently, includes the first Monday of the year with the ISO weeks, or the first Sunday of the year with the US week, or the first Saturday with the Jewish week, or the first Friday with the Islamic week).
I hope this helps resolving the confused (unsingned) reader just above. verdy_p (talk) 06:41, 2 May 2016 (UTC)[reply]

History

[edit]

I would like to see a little bit about the calendar's history. When was it first used? And by whom? Who or what agency invented it? For example, the link to years-with-leap-weeks says that the "first" one is 2009. Do they mean the "next" one? Or is the calendar so recent that we haven't had one yet? —Preceding unsigned comment added by MiguelMunoz (talkcontribs) 01:59, 11 July 2008 (UTC)[reply]

It's actually fairly similar to some old Nordic/Icelandic calendar variants, which were designed so that each year would contain an integral number of weeks. However, its modern usage seems to have originated in large industrial corporations which planned their production schedules and payrolls around the work-week. AnonMoos (talk) 00:03, 15 December 2008 (UTC)[reply]

I would also like to know *specifically* who submitted the standard and also, for religious reasons, specifically why they chose Monday as the first day of the week when the first day of the week has been Sunday for centuries. Is the Catholic Church STILL trying to move Sun's Day to the 7th day of the week? Interesting for the scholastic theologians among us. WebTigers (talk) 17:08, 5 July 2011 (UTC)[reply]

Terminology

[edit]

The article used Gregorian Year correctly, and used ISO year to mean the yyyy of yyyy-Www-d. But the yyyy of yyyy-mm-dd is also fully defined in ISO 8601, and has priority. Alas, ISO offers no convenient term for the week-numbering year. Therefore, I have changed "ISO year" to "ISO week-numbering year" except where the "week" context was strong enough already.

ISO 8601 says nothing about "leap week". I have changed the article accordingly. While the term is useful in classifying calendars in accordance with which unit they occasionally insert, there has been in the Article a source of possible confusion in using "leap year" to refer to a 53-week year, because its use to refer to a Jan..Dec containing a Feb 29 is so thouroghly established. That may need further attention.

For details, see the History page.

82.163.24.100 (talk) 12:49, 22 September 2008 (UTC)[reply]

 Done

Connecting weeks to months

[edit]

The ISO standard does not connect weeks to months in any way. The recent addition working this out in great detail is not based on the standard and therefore does not belong in this article. Additionally, whenever for practical purposes (mostly financial) weeks are assigned to months, this is rarely done in the way described. The usual way is to have fixed 4-4-5 or 5-4-4 patterns. The section is not sourced and constitutes clear WP:OR. −Woodstone (talk) 03:37, 27 March 2010 (UTC)[reply]

I believe the table and accompanying text to be covered by the “routine calculations” exception to WP:OR, just like the equivalent formulations of the “first Thursday” rule. ISO 8601 doesn’t say anything about “Doomsday” or dominical letter and it doesn’t provide a list of dates with fixed week number, yet this article does.
I certainly won’t object if we included a reference to regular patterns for 13-week quarters, noting that this is the approach taken in practice. — Christoph Päper 11:49, 27 March 2010 (UTC)[reply]
It is not a routine calculation, because the formula is not applicable. You forget to mention the sequel in WP:OR "provided ... that the arithmetic and its application correctly reflect the information published by the sources". The ISO standard uses the formula only to define the first week in a year; it does not apply to months. Applying it to months has no base in the standard.
The question if Doomsday and dominical letter are OR as well has no bearing on this issue.
Woodstone (talk) 16:22, 27 March 2010 (UTC)[reply]

the first calendar week of a year is that one which includes the first Thursday of that year

— ISO 8601:2004, section 2.2.10
Yes, the text of the standard does not apply the rule to months since it only has to deal with weeks belonging to one year or another. It is, however, obvious that this is just an adapted, narrow formulation of the generic rule that a week belongs to the larger calendar entity (month, quarter, year, century, …) the majority of its 7 days lie within.
I already indicated in an edit summary that I didn’t add this section to promote (nor discourage) such usage, but merely to illustrate the fact that week date and month date don’t align well. I’m now convinced that this should be followed by the conclusion seen taken in real life, namely 13-week quarters with a regular pattern. (I don’t think anyone is actually using the alternative currently, which was 13 “months” of 4 weeks each.) — Christoph Päper 00:59, 28 March 2010 (UTC)[reply]
All true, but this article is about the "ISO week" as described in its standard. All else is speculation. You might want to find another article where you can vent those ideas. −Woodstone (talk) 03:41, 28 March 2010 (UTC)[reply]
We have ISO 8601 for strictly standard-related stuff. This article can be a bit more relaxed, in my humble opinion, and expand on the effects of (this kind of) week numbering. The table of week-fixed dates already does that. — Christoph Päper 13:17, 28 March 2010 (UTC)[reply]
But as far as I can see it is not fact, but speculation. Is there any evidence that organisations are using the shown association of weeks to months? −Woodstone (talk) 13:42, 28 March 2010 (UTC)[reply]
Well, that’s not what I’m saying. What I’m saying is, this is what you would get if you applied the same rule to months, but in practice people prefer to use more regular patterns, which are not or at least less related to the traditional months. I refrained from adding the But because we’re still discussing that section. — Christoph Päper 20:54, 28 March 2010 (UTC)[reply]

If, however, the rule for first week of the year was applied to Gregorian months the pattern would be irregular. The only 4 months (or 5 in a long year) that would have 5 weeks were those with at least 29 days starting on Thursday, those with 30 or 31 days starting on Wednesday, and those with 31 days starting on Tuesday.

Weeks per month depending on the weekday of 1 January; in leap years adjacent months may switch their week count (“4* 5*”)
1 Jan Mon Tue Wed Thu Fri Sat Sun
Jan 4 5 5 5 4 4 4
Feb 4* 4 4 4 4 4 4
Mar 5* 4 4 4 4* 5 5
Apr 4 4 4* 5 5* 4 4
May 5 5 5* 4 4 4 4*
Jun 4 4 4 4 4* 5 5*
Jul 4 4* 5 5 5* 4 4
Aug 5 5* 4 4 4 4* 5
Sep 4 4 4 4* 5 5* 4
Oct 4* 5 5 5* 4 4 4
Nov 5* 4 4 4 4 4* 5
Dec 4 4 4* 5 5 5* 4
Year 52 52 52* 53 52 52 52

I reverted (again) because you still have not given a reference to show that it is used in a significant real world environment. −Woodstone (talk) 14:30, 9 August 2010 (UTC)[reply]

Like I said back in March, I do not see the need to provide such an example. I just had other things to do at the time so forgot about this article.
Calendars (and date pickers) are often layed out in seven columns for the week days. It is common to split the rows at Gregorian month boundaries. There are (at least) three ways to do this:
  1. Only show the days belonging to the month; duplicate weeks as necessary.
  2. Also show the days from the previous or following month, but dimmed; duplicate weeks as necessary.
    1. Dynamically show four, five or six wees.
    2. Dynamically show five or six weeks, because only non-leap February can fit completely in four weeks.
    3. Always show six rows of weeks, because that is the maximum of weeks dates from a month can fall in (e.g. Outlook).
  3. Do not split week rows; label four or five consecutive rows with one month name.
August 2010
30 1
31 2 3 4 5 6 7 8
32 9 10 11 12 13 14 15
33 16 17 18 19 20 21 22
34 23 24 25 26 27 28 29
35 30 31
August 2010
30 25 26 27 28 29 30 1
31 2 3 4 5 6 7 8
32 9 10 11 12 13 14 15
33 16 17 18 19 20 21 22
34 23 24 25 26 27 28 29
35 30 31 1 2 3 4 5
August 2010
31 2 3 4 5 6 7 8
32 9 10 11 12 13 14 15
33 16 17 18 19 20 21 22
34 23 24 25 26 27 28 29
2010
30 27 28 29 30 31 1 Jul
31 2 3 4 5 6 7 8 Aug
32 9 10 11 12 13 14 15
33 16 17 18 19 20 21 22
34 23 24 25 26 27 28 29
35 30 31 1 2 3 4 5 Sep
36 6 7 8 9 10 11 12
37 13 14 15 16 17 18 19
38 20 21 22 23 24 25 26
39 27 28 29 30 1 2 3
40 4 5 6 7 8 9 Oct
September 2010
35 1 2 3 4 5
36 6 7 8 9 10 11 12
37 13 14 15 16 17 18 19
38 20 21 22 23 24 25 26
39 27 28 29 30
September 2010
35 30 31 1 2 3 4 5
36 6 7 8 9 10 11 12
37 13 14 15 16 17 18 19
38 20 21 22 23 24 25 26
39 27 28 29 30 1 2 3
September 2010
35 30 31 1 2 3 4 5
36 6 7 8 9 10 11 12
37 13 14 15 16 17 18 19
38 20 21 22 23 24 25 26
39 27 28 29 30 1 2 3
The last option is, oviously, the use case where you would apply the ISO week rule to months. This does not need to be visible as clearly, imagine continuously scrolling week rows with a month (and year) label which is not large enough to bear any two names at once.
Options one and two are prevalent in paper calendars focused on months. — Christoph Päper 18:10, 9 August 2010 (UTC)[reply]
As before, the status of validity is only your mind game, applying a rule to cases it is not meant for. It should only be put in the article if it can be shown that substantial and documented use of this in the real world. I don't think I have ever seen it. Also a single month calendar with missing days I've never seen. −Woodstone (talk) 12:07, 11 August 2010 (UTC)[reply]
Whether you believe it or not, in some applications it is necessary to decide which month a week shall belong to. I gave one example. ISO 8601 offers a straightforward for this, but does not explicitly say so, because it only needs to care for the Dec/Jan boundary. I have rephrased the paragraph to reflect this and will now put it back in, without the table. — Christoph Päper 10:55, 12 August 2010 (UTC)[reply]

Contradiction in section “Weeks per year”

[edit]

I’ve moved the section Calendar cycle to section Weeks per year, after I had added some simple observations on the pattern there. These contradict! Could someone please check the list of years with 53 weeks on the one hand and the cycle calculations with doomsday and dominical letters on the other hand? — Christoph Päper 10:42, 23 March 2011 (UTC)[reply]

Perhaps see my talk post elsewhere: Talk:Seven-day week#Week numbering systems-- (talk) 20:55, 23 March 2011 (UTC)[reply]
No, sorry. It is possible that the calendar cycle section was written by someone using the Doomsday algorithm and I don’t know whether it’s valid outside the range 1900–2100. If I remember correctly I was the one that created the list of 53-week years in the Gregorian 400-year cycle, but I can’t find my notes on those calculations. — Christoph Päper 10:15, 24 March 2011 (UTC)[reply]
I fixed it, "unusual" things can only happen across 100, 200 and 300.--Patrick (talk) 13:22, 24 March 2011 (UTC)[reply]

Human readability

[edit]

Why does the article not mention that dates in week-date format are basically incomprehensible to a human viewers? I definitely expected this to be listed in the disadvantages section... 203.206.239.111 (talk) 00:54, 12 May 2011 (UTC)[reply]

Many businesses work with weekly calendars. For the people working in them the week notation is completely familiar. −Woodstone (talk) 10:46, 12 May 2011 (UTC)[reply]
Indeed. E.g., in Danish schools, "Wednesday in week 40" may be a far more useful way of identifying a day than "October 5th". For one thing, in a school with a weekly schedule, includng the week-day is most useful, and for another, longer-term scheduling often involves entries like: "Week 38-40: Medieval History", say. In such a context, it is the standard way of giving dates that is nearly incomprehensible. Of course, one may list as a disadvantage of either system that they are mutually incomprehensible (or at least hard to convert mentally - a bit like feet and metres, just worse).-- (talk) 14:21, 12 May 2011 (UTC)[reply]

Why Thursday?

[edit]

Article: The ISO 8601 definition for week 01 is the week with the year's first Thursday in it.

There's no mention of why it's Thursday. Was it an arbitrary choice or is there some rationale? As this scheme is about working weeks, why wasn't it the naively obvious candidate, Monday? 92.0.230.198 (talk) 12:53, 17 January 2015 (UTC)[reply]

Thursday is in the middle of the week. So the majority of the days in each week will belong to the ISO week-numbering year with the same number as their Gregorian year. So a week with three days in 2008 and four days in 2009 will belong to the ISO week-numbering year 2009. And a week with four days in 2009 and three days in 2010 will also belong to the ISO week-numbering year 2009. Boivie (talk) 17:21, 17 January 2015 (UTC)[reply]

Simple algorithm for ISO leap week

[edit]

Verdy p (talk · contribs) put this into an inline comment in an edit that I’ve reverted:

FALSE assertion: “There is no simple algorithm to determine whether a year has 53 weeks without tabular lookup from its ordinal number alone.”

NO table lookup is necessary: to determine the weekday for January 4 in that year , and to see if that year is leap (has a February 29), only requires modular arithmetic (without any test) in both parts, based only the year ordinal number.

So what’s a simple algorithm to determine from the ordinal year number a) whether it has a 53rd week or at least b) what’s the DOW of 4 January? — Christoph Päper 19:53, 27 April 2016 (UTC)[reply]

Look at examples in Templates used on this wiki (e.g. Template:JULIANDAY): there's no lookup, no test (except for testing incorrect usage of the template when a year is not indicated), but only modular arithmetic.
From that template the days of week is just the integer part of the JULIANDAY modulo 7, again without any lookups or tests needed.
{{JULIANDAY|2016}} returns 2457389 (computed value for 1 January 2016, at 12:00:00 UTC), and modulo 7 you have the answer: 4 (Friday, as 0 means Monday with this simple formula).
For the 4th of January, this is also simple:
{{JULIANDAY|2016|1|4}} returns 2457392 (computed value for 4 January 2016, at 12:00:00 UTC), and modulo 7 you have the answer: 0 (Monday).
verdy_p (talk) 16:26, 1 May 2016 (UTC)[reply]
Our definitions of “simple algorithm” seem to differ then. The Julian and even the Gregorian leap rules are simple as in everyone can decide whether a given year is leap in an instance without using pen and paper or a calculator. Calculating the Julian day number for 1 or 4 January, then performing a modulo 7 operation on it and deciding upon the result with special case for Gregorian leap-day years, doesn’t seem simple to me. I agree, though, that it doesn’t require a table lookup (and personally never claimed otherwise as far as I remember). — Christoph Päper 11:16, 3 May 2016 (UTC)[reply]
Robert H. Gent actually provides two non-tabular algorithms for determining from an ordinal year number whether it’s a long or a short year, i.e. whether it contains a 53rd week or not:
Should either of these be included in the article? — Christoph Päper 14:44, 30 June 2016 (UTC)[reply]

Assessment comment

[edit]

The comment(s) below were originally left at Talk:ISO week date/Comments, and are posted here for posterity. Following several discussions in past years, these subpages are now deprecated. The comments may be irrelevant or outdated; if so, please feel free to remove this section.

Good technical description! It would be really nice to have, in addition, a table or a clickable calendar, which at minimum lists the first day of week 1 for a whole bunch of years, or (even better) enables one to enter a year/month/day and get back the week number for that date. I don't know if this is too difficult. But I spent quite some time reading this article before I found what I wanted--that week 1 in 2010 starts on Jan 4. Hambleton (talk) 19:18, 13 April 2009 (UTC)[reply]

Last edited at 19:18, 13 April 2009 (UTC). Substituted at 20:02, 1 May 2016 (UTC)

Possible weeks of dates

[edit]

There’s a section entitled “Dates with fixed week number”. I’m considering to change it in a way that it says something about possible week numbers for all dates not just the ones with 100% or 97% likeliness, but I’m not sure yet whether and how this should be done.

From January 4 through February 29, all dates fall in one of two weeks of the same year. The probabilities repeat every seven days. If multiplied by 400 (or 97 for Feb29), one gets the absolute occurences per Gregorian leap cycle.

ISO weeks W01 through W09, January and February
Weeks Jan04 Jan11 Jan18 Jan25 Feb01 Feb08 Feb15 Feb22 Feb29 Jan05 Jan12 Jan19 Jan26 Feb02 Feb09 Feb16 Feb23 Jan06 Jan13 Jan20 Jan27 Feb03 Feb10 Feb17 Feb24 Jan07 Jan14 Jan21 Jan28 Feb04 Feb11 Feb18 Feb25 Jan08 Jan15 Jan22 Jan29 Feb05 Feb12 Feb19 Feb26 Jan09 Jan16 Jan23 Jan30 Feb06 Feb13 Feb20 Feb27 Jan10 Jan17 Jan24 Jan31 Feb07 Feb14 Feb21 Feb28
W0n 100% 85¾% 71½% 57% 43% 28½% 14½%
W0n+1 0% 14¼% 28½ % 43%  57% 71½% 85½%

From March 1 till December 28, the ratios change by a tad over 3% due to leap years beginning on a Thursday (DC) which have the Thursday of W09 on February 29, i.e. the only years where 5 weeks belonged to February if one applied the Thursday rule.

ISO weeks W09 through W52, March to December
Weeks Mar01 … Dec27 Mar02 … Dec28 Mar03 … Dec22 Mar04 … Dec23 Mar05 … Dec24 Mar06 … Dec25 Mar07 … Dec26
Wn 96¾% 82¼% 68% 53¾% 39¼% 25¼% 10¾%
Wn+1 3¼% 17¾% 32% 46¼% 60¾% 74¾% 89¼%

Around New Year, things get a bit more complicated, because the dates December 29 through January 2 can fall in 3 different weeks: W53 usually spans Dec28–Jan03, but in DC years Dec27–Jan02. That means it contains 7 out of 8 possible dates, whereas weeks W01–W08 have a range of 13 possible dates and the rest even 14 dates.

Dates which can fall in ISO week 53
Week Dec27 Dec28 Dec29 Dec30 Dec31 Jan01 Jan02 Jan03 Jan04
W52 96¾% 82¼% 68% 53¾% 39¼% 25¼% 10¾% 0% 0%
W53 3¼% 17¾% 17¾% 17¾% 17¾% 17¾% 17¾% 14½%  0%
W01 0%  0% 14¼% 28½% 43% 57% 71½% 85½% 100%
Last 85½% 100% 85¾% 71½% 57% 43% 28½% 14½% 0%
W52/53 100% 100% 85¾% 71½% 57% 43% 28½% 14½% 0%

Ordinal days, DDD, are similar to Jan/Feb dates, because the 366th (leap) day is appended at the end of the year. That means, one could provide a simple formula using modulo 7 to get the week number from the three-digit day number.

Any suggestions or concerns, diagrams, tables or references (besides RH van Gent’s site)? — Christoph Päper 20:15, 4 July 2016 (UTC)[reply]

More citations needed

[edit]

This article is very informative, rich in facts, but unfortunately it has very few citations - so it is difficult to verify against sources. I appreciate that many references might point to ISO materials – however there are entire sections, tables, algorithms and formulae that really could do with some pointers to sources, so that we can be sure there is no original research in here. For now I have tagged the whole page as `more citations needed` to get the ball rolling. See the parent page ISO 8601 for examples of more comprehensive referencing and see WP:CITE for help. Artemgy (talk) 14:11, 28 March 2020 (UTC)[reply]

It's been almost two years. Can this note be removed from the top of the page and we can discuss whcih sections would need additional references?
Personally, I think that the reference to ISO 8601-1 is pretty much all that is needed, because the rest is basically covered by WP:CALC. — Christoph Päper 12:49, 29 January 2022 (UTC)[reply]

"Disadvantages"

[edit]

We should change this title to "Differences" since every Person has a different understanding if this is a Disadvantage. --MajorValerian (talk) 13:32, 7 May 2020 (UTC)[reply]

First working day of the year

[edit]

From the list of properties of the first week of a year:

It has the year's first working day in it, if Saturdays, Sundays and 1 January are not working days.

This only works if 2 January is a working day. If 1 January is on a Thursday and 1 and 2 January are off then the first working day will be on Monday, 5 January, which is in Week 2. In some regions 2 January is a holiday, where I live it is Berchtoldstag. --Adi86 (talk) 14:14, 20 February 2021 (UTC)[reply]

IMPORTANT

[edit]

"A precise date is specified by the ISO week-numbering year in the format YYYY, a week number in the format ww prefixed by the letter 'W', and the weekday number, a digit d from 1 through 7, beginning with Monday and ending with Sunday." WRONG. Technically, Sunday is 0, not 7. Because 1 week is already 7 days and Base 7 doesn't have the number 7. Also, in "The last week of the ISO week-numbering year, i.e. W52 or W53, is the week before W01 of the next year.", there is no W53 or WK53. The first week of the year is W00 or WK00. Please don't delete this text. Thank you for understanding. 2404:3C00:502F:4C80:94CC:986C:1979:3C38 (talk) 06:18, 3 March 2021 (UTC)[reply]

 Ignore This is nonsense that has nothing to do with the actual standard. — Christoph Päper 07:31, 12 April 2021 (UTC)[reply]

Irregular week length

[edit]

It would be better to add 1 or 2 8-day weeks every year, so every year starts with Sunday. The weeks should be numbered from 00 to 51 and the days should be numbered from 0 to 6 or 7. That way, it would be easier to skip count.

SKIP COUNTING BY 10 DAYS USING WEEK DATE FORMAT


0000-01-3

0000-02-6

0000-04-2

0000-05-5

0000-07-1

0000-08-4

0000-10-0

0000-11-3

0000-12-6

0000-14-2

And so on... 2404:3C00:502F:4C80:E1F6:7353:D1D1:F484 (talk) 03:39, 24 July 2021 (UTC)[reply]

 Ignore You will probably find something like that on the Calendars Wikia, but not in this Wikipedia article which reports the design of the respective international standard. — Christoph Päper 11:44, 27 July 2021 (UTC)[reply]

Recent change in "Examples of contemporary dates..."

[edit]

I wonder what the reasoning was behind the change of contemporary examples to 1970s/80s dates instead of the more recent and arguably more relatable dates in the 2000s: https://en.wikipedia.org/w/index.php?title=ISO_week_date&type=revision&diff=1013225877&oldid=1012594781

Also the example about a bug with Twitter in 1986 does not make any sense at all now: "A programming bug confusing these two year numbers is probably the cause of some Android users of Twitter being unable to log in around midnight of 29 December 1986 UTC."

I propose reverting those changes.

Fdemmer (talk) 08:21, 23 March 2021 (UTC)[reply]

I agree. The standard itself mostly uses examples from the 1980s, because that's when its predecessors were first published. — Christoph Päper 07:30, 12 April 2021 (UTC)[reply]