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?.
 
 

 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
Pavel Stehule
Date:
Hello,

See doc for Extract

SELECT EXTRACT(day FROM CURRENT_DATE) -- day or year or month

Regards
Pavel Stehule

On Sat, 18 Oct 2003, 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?.
>
>
>
>  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
Steve Crawford
Date:
You probably want either the extract, date_part, date_trunc or to_char
functions:

select extract('year' from now());
 date_part
-----------
      2003

select date_part('day', now());
 date_part
-----------
        20


select date_trunc('day',now());
       date_trunc
------------------------
 2003-10-20 00:00:00-07

select to_char(now(),'mm/dd/yyyy');
  to_char
------------
 10/20/2003

Cheers,
Steve


On Saturday 18 October 2003 9:41 am, 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?.
>
>
>
>  Regards,
>  Ch.V.J. Kumar
>
> |Associate Consultant | iGATE Global Solutions Limited | Office:
> | 5521701 xtn  3031 | 9886219429|  Jitender.Chakka@igate.com