Re: Function to convert bigint to date

Поиск
Список
Период
Сортировка
От Steven Klassen
Тема Re: Function to convert bigint to date
Дата
Msg-id 20041026034636.GA23780@commandprompt.com
обсуждение исходный текст
Ответ на Re: Function to convert bigint to date  ("Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar.Pyatalo@honeywell.com>)
Список 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 по дате отправления:

Предыдущее
От: "Pradeepkumar, Pyatalo (IE10)"
Дата:
Сообщение: Re: Function to convert bigint to date
Следующее
От: Sean Davis
Дата:
Сообщение: Simple function question