Extract giving wrong week of year - Mailing list pgsql-general

From Ben Primrose
Subject Extract giving wrong week of year
Date
Msg-id df5f54d230b61e4d6a3c9161c3f7ca06@mail.gmail.com
Whole thread Raw
Responses Re: Extract giving wrong week of year
List pgsql-general

All,

                I’m seeing some odd behavior from the extract function.  Any idea why extract would think January 3rd of next year is the 53rd week of the year?

Thanks

Ben

 

[bprimrose@primrose partitioning]$ psql

Null display is "¤".

Line style is unicode.

Output format is wrapped.

Timing is on.

psql (9.3.9)

Type "help" for help.

 

bprimrose@home=> select extract (week from '2016-01-03 00:01:00'::timestamp);

date_part

───────────

        53

(1 row)

 

Time: 1.128 ms

bprimrose@home=> select version();

                                                   version                                                   

─────────────────────────────────────────────────────────────────────────────────────────────────────────────

PostgreSQL 9.3.9 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6), 64-bit

(1 row)

 

 

pgsql-general by date:

Previous
From: yuryu
Date:
Subject: Test failover for PosgreSql 9.2
Next
From: Tom Lane
Date:
Subject: Re: Extract giving wrong week of year