| From: | "Jaime Casanova" <systemguards(at)gmail(dot)com> |
|---|---|
| To: | "Grover Navia" <grover8navia(at)yahoo(dot)es> |
| Cc: | pgsql-es-ayuda(at)postgresql(dot)org |
| Subject: | Re: Dar formato literal a las fecha |
| Date: | 2006-04-01 05:47:36 |
| Message-ID: | c2d9e70e0603312147t7523b17p87e5dd6d90291fff@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-es-ayuda |
On 3/31/06, Grover Navia <grover8navia(at)yahoo(dot)es> wrote:
>
> Hola Lista
>
> Quisiera que me ayuden con esto, lo que trato de hacer es mediante un
> consulta Sql darle formato a un campo de mi tabla como sigue:
>
> miTabla
> miCampo (de tipo date)
>
> SELECT .......... miCampo From miTabla
>
> miCampo
> ------|---------------
> | Mayo/2006 sila fecha fuera '22/05/2006'
> | Abril/2006 sila fecha fuera '18/04/2006'
>
> En resumen lo que trato de hacer es convertir el mes en literal haciendo de
> lado el dia. Alguien podria decirme como hago esto
>
> De ante mano las gracia por su colaboración
>
> Saludos
> Grover Navia
>
select case extract(month from miCampo) when 1 then 'Enero'
when 2
then 'Febrero'
when 3
then 'Marzo'
when 4
then 'Abril'
when 5
then 'Mayo'
when 6
then 'Junio'
when 7
then 'Julio'
when 8
then 'Agosto'
when 9
then 'Septiembre'
when 10
then 'Octubre'
when 11
then 'Noviembre'
when 124
then 'Diciembre'
end || '/' || extract(year from miCampo)
from tabla;
quiza exista una mejor forma de hacerlo, pero es lo primero que se me ocurrio
--
Atentamente,
Jaime Casanova
"What they (MySQL) lose in usability, they gain back in benchmarks, and that's
all that matters: getting the wrong answer really fast."
Randal L. Schwartz
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jaime Casanova | 2006-04-01 05:52:05 | Re: Problemas con la Ñ otra vez.... |
| Previous Message | Jaime Casanova | 2006-04-01 05:21:36 | Re: restaurar vista |