Re: unix timestamp

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: unix timestamp
Дата
Msg-id 3B7C2F88.76ED8282@fourpalms.org
обсуждение исходный текст
Ответ на unix timestamp  ("Ben-Nes Nimrod" <nimrod@canaan.co.il>)
Список pgsql-general
> how can i use unix timestamp as a data type?

You don't want to. Really.

> i thought that the timestamp data type use the unix timestamp but
> found out that it didnt.. :(

Right. One second resolution and limited range was considered a problem.

> do i need to use an int data type for holding unix timestamp or there
> is a data type which was build specialy for that?

I would suggest using the native timestamp type. You can convert back
and forth using various techniques, but you should find that the
examples below give you a good start:

lockhart=# select date_part('epoch',timestamp 'now');
 date_part
-----------
 997993780

lockhart=# select timestamp(integer '997993780');
       timestamp
------------------------
 2001-08-16 20:29:40+00


hth

                      - Thomas

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

Предыдущее
От: "Dr. Evil"
Дата:
Сообщение: Re: Storing images in PG?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Killing inactive connections