

#Calendar that shows week number iso#
Sunday as day 0 rather than day 7 as required by ISO 8601.ĬREATE PROCEDURE iso8601_weekday(dateval DATE DEFAULT TODAY) RETURNING CHAR(10) This procedure uses iso8601_weeknum() to format the YYYY-Www part of theĭate, and appends '-d' to the result, allowing for Informix's coding of Shift rotations are organized per week and knowing the week numberĪnd the day of the week is more handy than knowing the day of the Tuesday (day 2) of the first week of 1997 can also be written asįor applications like industrial planning where many things like The week notation can also be extended by a number indicating theĭay of the week. Interchange Formats - Information Interchange - Representation of Calculate ISO 8601 Week Number for given dateĪccording to a summary of the ISO 8601:1988 standard "Data Elements and

One line comments start ' -' possibly multiline comments start with ' '. There are extensive notes in the comments, including relevant text from the standard. The '||' operator is the SQL string concatenation operation, and Sunday is day 0, Monday is day 1. That is an extract from a comment in the following code, which is actually in Informix SPL (Stored Procedure Language), but is readable - though probably not writable - without much further explanation. Similarly, Saturday 1st JanuaryĢ005 is in 2004-W53, but Sunday 1st January 2006 is in 2005-W52. One answer is on Friday 1st January 2010, which is in 2009-W53 (as, Then comes the interesting testing phase - when do you get week 53? Consequently, the 29th, 30th and 31st of December 20xx could be in week 1 of 20xy (where xy = xx + 1), and the 1st, 2nd and 3rd of January 20xy could all be in the last week of 20xx. It also says Week 1 of a year is the one which contains at least 4 days from the given year. ISO 8601 defines a standard for the representation of dates, times and time zones. Be aware that while your definition of nth week of the year is tenable, it is also not 'the' standard one.
