From: | Steve Atkins <steve(at)blighty(dot)com> |
---|---|
To: | PostgreSQL General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: to_char(timestamp, format) is changing the year! |
Date: | 2014-11-30 21:22:27 |
Message-ID: | 236D4248-5354-4FE1-8735-73B51CBA7505@blighty.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Nov 30, 2014, at 1:05 PM, Stephen Woodbridge <woodbri(at)swoodbridge(dot)com> wrote:
> Hi,
>
> I am have a problem when I format a timestamp in that it is changing the year. This can't be right, so either I don't understand
You're using "IYYY" which is the "ISO year", which is based on Mondays or Thursdays or something equally useless. You probably want "YYYY" instead.
Cheers,
Steve
> or I have found a nasty corner case bug.
>
> This does not happen on all dates
>
> select '2014-12-31 00:00:00'::timestamp without time zone,
> to_char('2014-12-31 00:00:00'::timestamp without time zone, 'IYYY-MM-DD HH24:MI:SS');
>
> "2014-12-31 00:00:00";"2015-12-31 00:00:00"
>
> It appears that this also happens for all timestamps after "2014-12-28 23:59:59" to the end of the year and then "2015-01-01 00:00:00" is ok again.
>
> I have found this on 9.2 and 9.3.
>
> "PostgreSQL 9.2.9 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit"
>
> "PostgreSQL 9.3.5 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit"
>
> Any thoughts on how to work around this?
>
> Thanks,
> -Steve
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
From | Date | Subject | |
---|---|---|---|
Next Message | Léa Massiot | 2014-11-30 22:03:10 | Re: Remote PostgreSQL database - C/C++ program / Unix / Required Libraries |
Previous Message | Adrian Klaver | 2014-11-30 21:19:30 | Re: to_char(timestamp, format) is changing the year! |