On Tue, 17 Oct 2000, Tom Lane wrote:
> "Tom Rogers" <trogers3@creigh.com> writes:
> > [to_char] gives the correct meridian value for all AM times but incorrectly
> > returns an AM meridian for PM times between 12:00 PM and 1:50:59 PM.
>
> I believe this is a known bug in the 7.0 implementation of to_char, and
> is long since fixed in development sources. Karel Zak is the author of
> to_char and would know for sure. Karel, does it make sense to
> back-patch a quick fix for this into REL7_0_PATCHES for the upcoming
> 7.0.3 release? If so, could you provide a patch?
Well, a quick fix is a quick fix. The patch for REL7_0_PATCHES is in the
attache. Note, it must be apply in src/backend/utils/adt, because it is not
created as --recursive.
Karel
PS. 7.1 contains more changes for to_char/to_timestamp, this fix PM/AM
only ....
test=# select to_char(t, 'HH24 hours = HH12 p.m.') from day;
to_char
--------------------
01 hours = 01 a.m.
02 hours = 02 a.m.
03 hours = 03 a.m.
04 hours = 04 a.m.
05 hours = 05 a.m.
06 hours = 06 a.m.
07 hours = 07 a.m.
08 hours = 08 a.m.
09 hours = 09 a.m.
10 hours = 10 a.m.
11 hours = 11 a.m.
12 hours = 12 p.m.
13 hours = 01 p.m.
14 hours = 02 p.m.
15 hours = 03 p.m.
16 hours = 04 p.m.
17 hours = 05 p.m.
18 hours = 06 p.m.
19 hours = 07 p.m.
20 hours = 08 p.m.
21 hours = 09 p.m.
22 hours = 10 p.m.
23 hours = 11 p.m.
00 hours = 12 a.m.
(24 rows)
Right?