15.00 - About ISO Computation - Teradata Database

Teradata Database SQL Functions, Operators, Expressions, and Predicates

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1145-015K
Language
English (United States)

About ISO Computation

The way in which a week, month, quarter, and year are defined in the ISO calendar is different from the Teradata and COMPATIBLE calendars. ISO has only complete weeks. All the business calendar functions and views use the following rules for ISO computation.

Week

An ISO week always has 7 days. There are no partial weeks. The ISO week always starts on Monday and ends on Sunday.

Year

Each year has 52 or 53 complete weeks. The year start or end is determined by applying the ISO Thursday rule to the week at the year border. If Thursday falls in the old year in the Gregorian calendar, the border week becomes part of the old year in the ISO calendar. If Thursday falls in the new year in the Gregorian calendar, the border week becomes part of the new year in the ISO calendar. For example, December 31, 2009, is a Thursday. Therefore, in the ISO calendar the week of Monday, December 28, 2009, through Sunday, January 3, 2010, is the last week in 2009. The first week of 2010 in the ISO calendar begins on Monday, January 4, 2010. In contrast, the Teradata calendar for 2010 begins on Friday, January 1.

Month

Each month has 4 or 5 complete weeks. The month start or end is determined by applying the ISO Thursday rule to the week at the month border. For example, in the ISO calendar, the month of October 2012 ends on Sunday, October 28, because Thursday in the border week falls on November 1. The new week that begins on Monday, October 29, becomes part of November.

Quarter

The ISO year is divided into 4 quarters with 13 weeks per quarter. There are 14 weeks in the last quarter if the year has 53 weeks. Quarters are divided into 3 months with a pattern of 4,4,5 or 4,5,4 or 5,4,4 weeks. If the year has 53 weeks, the last quarter has 3 months with a pattern of 4,5,5 or 5,4,5 or 5,5,4 weeks. The quarter start or end is determined by applying the ISO Thursday rule to the week at the month border in the last month of the quarter. The week at the month border belongs to the month that has Thursday of that week. For example, Friday, January 1, 2016, is part of a week in which Thursday falls in the last week and last quarter of 2015. Therefore, Friday, January 1, 2016, belongs to last quarter of 2015 in the ISO calendar and the first quarter of 2016 in the Teradata calendar.