Re: Function to convert bigint to date - Mailing list pgsql-novice

From Steven Klassen
Subject Re: Function to convert bigint to date
Date
Msg-id 20041026034636.GA23780@commandprompt.com
Whole thread Raw
In response to Re: Function to convert bigint to date  ("Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar.Pyatalo@honeywell.com>)
List pgsql-novice
* Pradeepkumar, Pyatalo (IE10) <Pradeepkumar.Pyatalo@honeywell.com> [2004-10-25 02:23:19 -0700]:

> But from the result I need to display only the date and not the
> time. Should I use extract() function to get the day, month and year
> seperately and then form the date format, or is there any other way
> to extract only the date part from the timestamp.

You can cast a timestamp to a date. You really need to give these
things a try yourself. You'd be surprised what you can figure out
through trial and error.

xinu=> select now()::timestamp;
            now
----------------------------
 2004-10-25 23:45:38.939148
(1 row)

xinu=> select (now()::timestamp)::date;
    now
------------
 2004-10-25
(1 row)

--
Steven Klassen - Lead Programmer
Command Prompt, Inc. - http://www.commandprompt.com/
PostgreSQL Replication & Support Services, (503) 667-4564

pgsql-novice by date:

Previous
From: "Pradeepkumar, Pyatalo (IE10)"
Date:
Subject: Re: Function to convert bigint to date
Next
From: Sean Davis
Date:
Subject: Simple function question