Re: How to typecast an integer into a timestamp?

Поиск
Список
Период
Сортировка
От Bruno Boettcher
Тема Re: How to typecast an integer into a timestamp?
Дата
Msg-id 20120128094343.GH7071@bboett.adlp.org
обсуждение исходный текст
Ответ на Re: How to typecast an integer into a timestamp?  (Adrian Klaver <adrian.klaver@gmail.com>)
Список pgsql-general
On Fri, Jan 27, 2012 at 08:17:37AM -0800, Adrian Klaver wrote:
> Did some digging. php-mktime returns the Unix epoch (seconds since January 1
> 1970 00:00:00 GMT)
indeed, didn't get it that postgres timestamp wasn't the same....

> Postgres has a function(to_timestamp) that will convert that to a timestamp:
>
> http://www.postgresql.org/docs/9.0/interactive/functions-formatting.html
>
> to_timestamp(double precision)    timestamp with time zone    convert Unix
> epoch to time stamp    to_timestamp(1284352323)
>
> So something like the below in your query should work:
>
> to_timestamp(int_returned_from_php)
  very neat that does it!
  thanks a lot everybody!

  ciao
  Bruno

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

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

Предыдущее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: pg_dump -s dumps data?!
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg_dump -s dumps data?!