Re: Extract date from a TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL column

Поиск
Список
Период
Сортировка
От Ian Barwick
Тема Re: Extract date from a TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL column
Дата
Msg-id 6aace1b8-6103-e766-d343-01d2e99bfc74@2ndquadrant.com
обсуждение исходный текст
Ответ на Extract date from a TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL column  (Patrick B <patrickbakerbr@gmail.com>)
Список pgsql-general
On 22-09-2016 12:37, Patrick B wrote:
> Hi guys,
>
> I'm using postgres 9.2 and got the following column:
>
>     start TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL
>
>
>     SELECT start FROM test1;
>
>
> 2015-12-18 02:40:00
>
>  I need to split that date into two columns on my select:
>
> 2015-12-18 = date column
> 02:40:00 = time column
>
> How can I do that without modifying any column/data?
> Maybe in a select?

TO_CHAR() is your friend:

  https://www.postgresql.org/docs/current/static/functions-formatting.html

Regards

Ian Barwick


--
 Ian Barwick                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, RemoteDBA, Training & Services


В списке pgsql-general по дате отправления:

Предыдущее
От: Patrick B
Дата:
Сообщение: Extract date from a TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL column
Следующее
От: Venkata B Nagothi
Дата:
Сообщение: Re: Extract date from a TIMESTAMP(6) WITHOUT TIME ZONE NOT NULL column