Bug in to_char()

From: Brian Powell <brian(at)filogroup(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Bug in to_char()
Date: 2000-07-12 16:24:36
Message-ID: B591F7E3.3AB2%brian@filogroup.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Greetings,

Working with PostGreSQL 7.02, I found the following problem:

The AM/PM designator in the to_char function does not work proper for 13:00
and 12:00.

See the following:

test=> select to_char('3-12-2000 14:00'::timestamp, 'Dy, HH12:MI PM');
to_char
---------------
Sun, 02:00 PM
(1 row)

This is correct.

test=> select to_char('3-12-2000 8:00'::timestamp, 'Dy, HH12:MI PM');
to_char
---------------
Sun, 08:00 AM
(1 row)

This is correct.

test=> select to_char('3-12-2000 13:00'::timestamp, 'Dy, HH12:MI PM');
to_char
---------------
Sun, 01:00 AM
(1 row)

NO! This is incorrect

test=> select to_char('3-12-2000 1:00'::timestamp, 'Dy, HH12:MI PM');
to_char
---------------
Sun, 01:00 AM
(1 row)

This is correctly 1 am.

nicklebys=> select to_char('3-12-2000 12:00'::timestamp, 'Dy, HH12:MI PM');
to_char
---------------
Sun, 12:00 AM
(1 row)

NO! This is 12:00 pm. 0:00 or 24:00 is 12:00 am.

Any known work arounds or bug fixes planned?

Thanks,
Brian

--
+-----------------------------------------------------------+
| Brian Powell, President brian(at)filogroup(dot)com |
| Filo Group www.filogroup.com |
| One Broadway, Suite 300A AIM: filogroupbrian |
| Denver, CO 80203 ICQ: 75037370 |
| 303.733.3248 office 303.733.7122 fax |
+-----------------------------------------------------------+

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ross J. Reedstrom 2000-07-12 16:55:56 Re: date comparision ???
Previous Message Gary Stainburn 2000-07-12 15:34:04 join if there, blank if not