469,603 Members | 2,049 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,603 developers. It's quick & easy.

Timestamp to date conversion...plz help me

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| Ji*************@igate.com



Nov 12 '05 #1
2 30351
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)

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #2
> 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
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Ben | last post: by
3 posts views Thread by praba kar | last post: by
1 post views Thread by Dave | last post: by
reply views Thread by Casey | last post: by
6 posts views Thread by Scott Nixon | last post: by
7 posts views Thread by JJ | last post: by
5 posts views Thread by kyosohma | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.