Talk:ISO week date
Time C‑class Mid‑importance | ||||||||||
|
Human readability
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)
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)
Discussion
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)
Use of term "Leap Week"
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)
Only six Week Numbers, 12-17 would be possible, 17 being rare. 82.163.24.100 22:19, 3 February 2007 (UTC)
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)
Done
- The page now mostly uses long year to refer to years with 53 weeks. — Christoph Päper 18:22, 9 August 2010 (UTC)
Templates
- Template:ISOWEEKDATE - Template:Evd The opposite function of {{ISOWEEKDATE2YMD}}
- Template:ISOWEEKDATE2YMD - Template:Evd The opposite function of {{ISOWEEKDATE}}
Disadvantage question
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)
- 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)
Done
Algorithms
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)
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 } }
--19:51, 24 February 2010 71.141.227.160
logic error found
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 (talk • contribs)
- As mentioned, in this system weeks start with Monday.--Patrick (talk) 23:51, 6 June 2008 (UTC)
Done
History
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 (talk • contribs) 01:59, 11 July 2008 (UTC)
- 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)
Terminology
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)
Done
Connecting weeks to months
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)
- 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)
- 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)
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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
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)
- 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:
- Only show the days belonging to the month; duplicate weeks as necessary.
- Also show the days from the previous or following month, but dimmed; duplicate weeks as necessary.
- Dynamically show four, five or six wees.
- Dynamically show five or six weeks, because only non-leap February can fit completely in four weeks.
- Always show six rows of weeks, because that is the maximum of weeks dates from a month can fall in (e.g. Outlook).
- Do not split week rows; label four or five consecutive rows with one month name.
|
|
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
- 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)
- 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)
- 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)
- 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)
Contradiction in section “Weeks per year”
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)
- Perhaps see my talk post elsewhere: Talk:Seven-day week#Week numbering systems--Nø (talk) 20:55, 23 March 2011 (UTC)
- 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)
- I fixed it, "unusual" things can only happen across 100, 200 and 300.--Patrick (talk) 13:22, 24 March 2011 (UTC)
- 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)