FW: [webmaster] Possible error in documentation for EXTRACT
TWIMC,
In the documentation for EXTRACT<http://www.postgresql.org/docs/9.5/interactive/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT>, the example for “century" is as follows:
SELECT EXTRACT(CENTURY FROM TIMESTAMP '2000-12-16 12:21:13');
Result: 20
SELECT EXTRACT(CENTURY FROM TIMESTAMP '2001-02-16 20:38:40');
Result: 21
I believe the result for the second SELECT is incorrect. I believe it should be:
SELECT EXTRACT(CENTURY FROM TIMESTAMP '2001-02-16 20:38:40');
Result: 20
Alternatively, you could change the example to:
SELECT EXTRACT(CENTURY FROM TIMESTAMP '2100-02-16 20:38:40');
Result: 21
If I have missed some point about how this should work, then please ignore this e-mail.
Thanks,
Mark Clark
mark.clark@enlightedinc.com
Import Notes
Reply to msg id not found: 52CAB828-024A-4FB2-9B17-94C2CBFE8FEA@postgresql.orgReference msg id not found: BD8B4F9D-A366-40F3-9D57-F313F64A4B9B@enlightedinc.comReference msg id not found: 52CAB828-024A-4FB2-9B17-94C2CBFE8FEA@postgresql.org
On Wed, 2016-04-06 at 17:05 +0000, Mark Clark wrote:
TWIMC,
In the documentation for EXTRACT, the example for “century" is as
follows:
SELECT EXTRACT(CENTURY FROM TIMESTAMP '2000-12-16 12:21:13');
Result: 20
SELECT EXTRACT(CENTURY FROM TIMESTAMP '2001-02-16 20:38:40');
Result: 21
I believe the result for the second SELECT is incorrect. I believe it should
be:
SELECT EXTRACT(CENTURY FROM TIMESTAMP '2001-02-16 20:38:40');
Result: 20
Alternatively, you could change the example to:
SELECT EXTRACT(CENTURY FROM TIMESTAMP '2100-02-16 20:38:40');
Result: 21
If I have missed some point about how this should work, then please ignore
this e-mail.
Thanks,
Mark Clark
mark.clark@enlightedinc.com
$ psql test
Timing is on.
psql (9.5.2)
Type "help" for help.
test=# SELECT EXTRACT(CENTURY FROM TIMESTAMP '2001-02-16 20:38:40');
date_part
-----------
21
(1 row)
Time: 1.336 ms
test=#
the 21st century began on 2001-01-01.
--
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs