Re: BUG #6219: date_part() function producting incorrect year - Mailing list pgsql-bugs

From Guillaume Smet
Subject Re: BUG #6219: date_part() function producting incorrect year
Date
Msg-id CALt0+o8+A_pPgpUkTtPcXn8y3O96Cn8sDLyz+1U=ZF9ZZ2Aopw@mail.gmail.com
Whole thread Raw
In response to BUG #6219: date_part() function producting incorrect year  ("Eric Vollnogel" <edvollnogel@dstsystems.com>)
List pgsql-bugs
On Wed, Sep 21, 2011 at 11:17 PM, Eric Vollnogel
<edvollnogel@dstsystems.com> wrote:
> The date_part('isoyear', some_column) function is not always returning the
> correct result. =A0See below:

See http://www.postgresql.org/docs/8.4/static/functions-datetime.html :
"Each ISO year begins with the Monday of the week containing the 4th
of January, so in early January or late December the ISO year may be
different from the Gregorian year. See the week field for more
information."

So ISO year 2011 starts on Monday the 3rd of January.

If you want the Gregorian year, just user 'year' instead of 'isoyear'.

--=20
Guillaume

pgsql-bugs by date:

Previous
From: "Eric Vollnogel"
Date:
Subject: BUG #6219: date_part() function producting incorrect year
Next
From: Tom Lane
Date:
Subject: Re: Broken selectivity with special inet operators