public inbox for [email protected]  
help / color / mirror / Atom feed
FW: [webmaster] Possible error in documentation for EXTRACT
2+ messages / 2 participants
[nested] [flat]

* FW: [webmaster] Possible error in documentation for EXTRACT
@ 2016-04-06 17:05  Mark Clark <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Mark Clark @ 2016-04-06 17:05 UTC (permalink / raw)
  To: pgsql-docs

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
[email protected]



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: FW: [webmaster] Possible error in documentation for EXTRACT
@ 2016-04-06 20:06  Reid Thompson <[email protected]>
  parent: Mark Clark <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Reid Thompson @ 2016-04-06 20:06 UTC (permalink / raw)
  To: pgsql-docs; +Cc: Reid Thompson <[email protected]>

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
> [email protected]

$ 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 ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-04-06 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-04-06 17:05 FW: [webmaster] Possible error in documentation for EXTRACT Mark Clark <[email protected]>
2016-04-06 20:06 ` Reid Thompson <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox