Обсуждение: Re: [HACKERS] to_char and i18n

Поиск
Список
Период
Сортировка

Re: [HACKERS] to_char and i18n

От
Euler Taveira de Oliveira
Дата:
--- Euler Taveira de Oliveira <eulerto@yahoo.com.br> escreveu:

> I have a patch like this. But this was for 7.4.x. I have to take a
> look
> at it.
>
The patch is attached. It implements day and month i18n. I fixed a few
misspelling comments. Docs is attached too.

template1=# select to_char(now(), 'Day, DD Month YYYY');
           to_char
------------------------------
 Sunday   , 25 December  2005
(1 registro)

template1=# select to_char(now(), 'TMDay, DD TMMonth YYYY');
          to_char
---------------------------
 Domingo, 25 Dezembro 2005
(1 registro)

template1=#


Comments?

Euler Taveira de Oliveira
euler[at]yahoo_com_br








_______________________________________________________
Yahoo! doce lar. Faça do Yahoo! sua homepage.
http://br.yahoo.com/homepageset.html

Вложения

Re: [HACKERS] to_char and i18n

От
Karel Zak
Дата:
On Sun, 2005-12-25 at 17:56 -0300, Euler Taveira de Oliveira wrote:
> --- Euler Taveira de Oliveira <eulerto@yahoo.com.br> escreveu:
>
> > I have a patch like this. But this was for 7.4.x. I have to take a
> > look
> > at it.
> >
> The patch is attached. It implements day and month i18n. I fixed a few
> misspelling comments. Docs is attached too.
>
> template1=# select to_char(now(), 'Day, DD Month YYYY');
>            to_char
> ------------------------------
>  Sunday   , 25 December  2005
> (1 registro)
>
> template1=# select to_char(now(), 'TMDay, DD TMMonth YYYY');
>           to_char
> ---------------------------
>  Domingo, 25 Dezembro 2005
> (1 registro)
>
> template1=#
>
>
> Comments?

I think it looks like a good patch. There's small problem that the
current to_char() output is possible use as argument for to_timestamp()
or to_date() function. It means you should implement vice-versa
conversion from string with TMMonth/TMDay to timestamp.

   to_timestamp('Domingo, 25 Dezembro 2005', 'TMDay, DD TMMonth YYYY')

Or.. at least describe in the docs that this way is unsupported
for 'TM' prefix.

    Karel

--
Karel Zak <zakkr@zf.jcu.cz>


Re: [HACKERS] to_char and i18n

От
Bruce Momjian
Дата:
Patch applied.  Thanks.

---------------------------------------------------------------------------


Euler Taveira de Oliveira wrote:
> --- Euler Taveira de Oliveira <eulerto@yahoo.com.br> escreveu:
>
> > I have a patch like this. But this was for 7.4.x. I have to take a
> > look
> > at it.
> >
> The patch is attached. It implements day and month i18n. I fixed a few
> misspelling comments. Docs is attached too.
>
> template1=# select to_char(now(), 'Day, DD Month YYYY');
>            to_char
> ------------------------------
>  Sunday   , 25 December  2005
> (1 registro)
>
> template1=# select to_char(now(), 'TMDay, DD TMMonth YYYY');
>           to_char
> ---------------------------
>  Domingo, 25 Dezembro 2005
> (1 registro)
>
> template1=#
>
>
> Comments?
>
> Euler Taveira de Oliveira
> euler[at]yahoo_com_br
>
>
>
>
>
>
>
>
> _______________________________________________________
> Yahoo! doce lar. Fa?a do Yahoo! sua homepage.
> http://br.yahoo.com/homepageset.html

Content-Description: 1242239392-i18n-date.diff

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: [HACKERS] to_char and i18n

От
Bruce Momjian
Дата:
Added to TODO:

    * Allow to_date() and to_timestamp() accept localized month names

Comment added to the C code to show where it has to happen.

---------------------------------------------------------------------------

Karel Zak wrote:
> On Sun, 2005-12-25 at 17:56 -0300, Euler Taveira de Oliveira wrote:
> > --- Euler Taveira de Oliveira <eulerto@yahoo.com.br> escreveu:
> >
> > > I have a patch like this. But this was for 7.4.x. I have to take a
> > > look
> > > at it.
> > >
> > The patch is attached. It implements day and month i18n. I fixed a few
> > misspelling comments. Docs is attached too.
> >
> > template1=# select to_char(now(), 'Day, DD Month YYYY');
> >            to_char
> > ------------------------------
> >  Sunday   , 25 December  2005
> > (1 registro)
> >
> > template1=# select to_char(now(), 'TMDay, DD TMMonth YYYY');
> >           to_char
> > ---------------------------
> >  Domingo, 25 Dezembro 2005
> > (1 registro)
> >
> > template1=#
> >
> >
> > Comments?
>
> I think it looks like a good patch. There's small problem that the
> current to_char() output is possible use as argument for to_timestamp()
> or to_date() function. It means you should implement vice-versa
> conversion from string with TMMonth/TMDay to timestamp.
>
>    to_timestamp('Domingo, 25 Dezembro 2005', 'TMDay, DD TMMonth YYYY')
>
> Or.. at least describe in the docs that this way is unsupported
> for 'TM' prefix.
>
>     Karel
>
> --
> Karel Zak <zakkr@zf.jcu.cz>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

--
  Bruce Momjian   http://candle.pha.pa.us
  SRA OSS, Inc.   http://www.sraoss.com

  + If your life is a hard drive, Christ can be your backup. +