Re: BUG #6219: date_part() function producting incorrect year

From: Guillaume Smet <guillaume(dot)smet(at)gmail(dot)com>
To: Eric Vollnogel <edvollnogel(at)dstsystems(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6219: date_part() function producting incorrect year
Date: 2011-09-21 21:47:23
Message-ID: CALt0+o8+A_pPgpUkTtPcXn8y3O96Cn8sDLyz+1U=ZF9ZZ2Aopw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Sep 21, 2011 at 11:17 PM, Eric Vollnogel
<edvollnogel(at)dstsystems(dot)com> wrote:
> The date_part('isoyear', some_column) function is not always returning the
> correct result.  See 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'.

--
Guillaume

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2011-09-21 21:57:50 Re: Broken selectivity with special inet operators
Previous Message Josh Berkus 2011-09-21 21:17:48 Re: Broken selectivity with special inet operators