From: | Espartano <espartano(dot)mail(at)gmail(dot)com> |
---|---|
To: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: Consulta Fechas |
Date: | 2007-08-07 14:27:06 |
Message-ID: | d353bd50708070727y72b3f67bl840b0114cf8734ef@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
El 7/08/07, Javier Chávez B. <jchavezb(at)gmail(dot)com> escribió:
>
> Estimados:
> Si tengo una tabla Table (cor_ano int , cor_movimiento int, tad_fecha date)
> como puedo :
> - obtener el año del dia de hoy???
pruebas=# SELECT date_part ('year',current_date );
date_part
-----------
2007
(1 row)
pruebas=# SELECT date_part ('year',now()::date );
date_part
-----------
2007
(1 row)
pruebas=# SELECT extract ('year' from now()::date );
date_part
-----------
2007
(1 row)
> - guardar en el campo tad_fecha la fecha de hoy..
> me refiero al equivalente en sqlserver a :
> - Select getdate() --> para obtener dia de hoy..
> - Select datepart('year',getdate())
pruebas=# SELECT now()::date;
now
------------
2007-08-07
(1 row)
pruebas=# SELECT current_date;
date
------------
2007-08-07
(1 row)
Date una buelta por aqui
http://www.postgresql.org/docs/8.2/static/functions-datetime.html
> Espero vuestros comentarios..
> Slds.
>
--
"Linux is for people who hate Windows, BSD is for people who love UNIX".
"Social Engineer -> Because there is no patch for human stupidity"
"The Unix Guru's View of Sex unzip ; strip ; touch ; grep ; finger ;
mount ; fsck ; more ; yes ; umount ; sleep."
"Documentation is like sex: when it is good, it is very, very good;
and when it is bad, it is better than nothing."
From | Date | Subject | |
---|---|---|---|
Next Message | Javier Chávez B. | 2007-08-07 14:31:42 | Re: Consulta Fechas |
Previous Message | Miguel Panuera | 2007-08-07 14:21:33 | Re: como devolver una consulta modificada?¿ |