On Tue, Dec 04, 2001 at 05:57:11PM -0600, Manuel Sugawara wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>
> > Manuel Sugawara writes:
> >
> > > Guys, attached is a patch against the 7.2b3 source tree which improves
> > > the i18n of the date formatting functions, using the nl_langinfo(3)
> > > function,
We don't directly call locale stuff in PostgreSQL code. It'sencapsulated in PGLC_ (pg_locale.c) API and all is cached,
forthis we use localeconv(3) that returns all in one struct.
(What portability of nl_langinfo()? The localeconv() is ANSI C andPOSIX functions.)
> > What's the effect of that?
>
> Currently none since I miss another part of the patch :-( -attached-,
> but if you add:
>
> setlocale(LC_TIME, "");
I mean is here more reason why not use LC_TIME and LC_NUMERIC incurrent sources. A correct solution will "per-columns"
locales.
_May be_ all in PostgreSQL is ready (intependent) to LC_TIME, but Inot sure with it. Thomas?
> in src/backend/main/main.c you will see month and day names printed
> according to the current locale.
>
> regress=# select to_char(now(),'fmday dd/month/yyyy');
> to_char
> --------------------------
> martes 04/diciembre/2001
> (1 row)
Sorry didn't see your original patch (I overlook and delete it in myIMBOX:-(). But I have a question -- do you solve
viceversaconversion from string to timestamp? The basic feature of to_char()is that all outputs must be possible parse
byto_timestamp() withsame format definition:
test=# select to_char('2001-12-05 00:00:00+01'::timestamp, 'fmday dd/month/yyyy');
to_char
-----------------------------wednesday 05/december /2001
(1 row)
test=# select to_timestamp('wednesday 05/december /2001', 'fmday dd/month/yyyy');
to_timestamp
------------------------2001-12-05 00:00:00+01
(1 row)
Karel
-- Karel Zak <zakkr@zf.jcu.cz>http://home.zf.jcu.cz/~zakkr/C, PostgreSQL, PHP, WWW, http://docs.linux.cz,
http://mape.jcu.cz