Thread: Timestamp to date conversion...plz help me

Timestamp to date conversion...plz help me

From
"Jitender Kumar C"
Date:
Hi,
    I want to extract date part (mm/dd/yy or any other date format) of Timestamp in postgreSQL.  Can anyone help me out how I can proceed?.

 Regards, 
 Ch.V.J. Kumar

|Associate Consultant | iGATE Global Solutions Limited | Office: 5521701 xtn  3031 | 9886219429|  Jitender.Chakka@igate.com

 

Re: Timestamp to date conversion...plz help me

From
Alvaro Herrera
Date:
On Sat, Oct 18, 2003 at 10:21:03PM +0530, Jitender Kumar C wrote:
> Hi,
>     I want to extract date part (mm/dd/yy or any other date format) of
>     Timestamp in postgreSQL.  Can anyone help me out how I can
>     proceed?.

SELECT your-timestamp-value::date

or, more standard,
SELECT CAST(your-timestamp-value AS date)

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"When the proper man does nothing (wu-wei),
his thought is felt ten thousand miles." (Lao Tse)

Re: Timestamp to date conversion...plz help me

From
nolan@celery.tssi.com
Date:
>     I want to extract date part (mm/dd/yy or any other date format) of Time=
> stamp in postgreSQL.  Can anyone help me out how I can proceed?.

You have at least two choices:

   select current_timestamp::date;

will give you the date in the default date format.

   select to_char(current_timestamp,'mm/dd/yy');

gives you control over the formatting.
--
Mike Nolan