Extracting date from timestamp

Started by Nageshwar Raoalmost 21 years ago3 messagesgeneral
Jump to latest
#1Nageshwar Rao
NageshwarR@PLANETASIA.COM

How to extract date(mm/dd/yyy) from a timestamp .

#2Michael Fuhr
mike@fuhr.org
In reply to: Nageshwar Rao (#1)
Re: Extracting date from timestamp

On Fri, May 06, 2005 at 06:26:14PM +0530, Nageshwar Rao wrote:

How to extract date(mm/dd/yyy) from a timestamp .

You could cast the timestamp to date. See also "Data Type Formatting
Functions" and "Date/Time Functions and Operators" in the "Functions
and Operators" chapter of the documentation.

http://www.postgresql.org/docs/8.0/interactive/functions-formatting.html
http://www.postgresql.org/docs/8.0/interactive/functions-datetime.html

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

#3Richard Huxton
dev@archonet.com
In reply to: Nageshwar Rao (#1)
Re: Extracting date from timestamp

Nageshwar Rao wrote:

How to extract date(mm/dd/yyy) from a timestamp .

See chapter 9.8. Data Type Formatting Functions, all about to_char()

If you just want your preset format you can use SELECT now()::date;

--
Richard Huxton
Archonet Ltd