From 3e803f72732f591a7913f5be212012ea1193705c Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 19 Feb 2007 17:41:39 +0000 Subject: Add "isodow" option to EXTRACT() and date_part() where Sunday = 7. --- doc/src/sgml/func.sgml | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 4a44e669b1b..ac7a0d16389 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,4 +1,4 @@ - + Functions and Operators @@ -5732,8 +5732,8 @@ SELECT EXTRACT(DECADE FROM TIMESTAMP '2001-02-16 20:38:40'); dow - The day of the week (0 - 6; Sunday is 0) (for - timestamp values only) + The day of the week as Sunday(0) to + Saturday(6) @@ -5741,7 +5741,7 @@ SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40'); Result: 5 - Note that extract's day of the week numbering is + Note that extract's day of the week numbering is different from that of the to_char function. @@ -5752,7 +5752,7 @@ SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40'); doy - The day of the year (1 - 365/366) (for timestamp values only) + The day of the year (1 - 365/366) @@ -5805,6 +5805,26 @@ SELECT EXTRACT(HOUR FROM TIMESTAMP '2001-02-16 20:38:40'); + + isodow + + + The day of the week as Monday(1) to + Sunday(7) + + + +SELECT EXTRACT(ISODOW FROM TIMESTAMP '2001-02-18 20:38:40'); +Result: 7 + + + This is identical to dow except for Sunday. This + matches the ISO 8601 day of the week numbering. + + + + + isoyear @@ -5923,8 +5943,7 @@ SELECT EXTRACT(MONTH FROM INTERVAL '2 years 13 months'); quarter - The quarter of the year (1 - 4) that the day is in (for - timestamp values only) + The quarter of the year (1 - 4) that the day is in @@ -5989,7 +6008,7 @@ SELECT EXTRACT(SECOND FROM TIME '17:12:28.5'); (ISO 8601), the first week of a year contains January 4 of that year. (The ISO-8601 week starts on Monday.) In other words, the first Thursday of - a year is in week 1 of that year. (for timestamp values only) + a year is in week 1 of that year. Because of this, it is possible for early January dates to be part of the -- cgit v1.2.3