Re: How to typecast an integer into a timestamp? - Mailing list pgsql-general

From Bruno Boettcher
Subject Re: How to typecast an integer into a timestamp?
Date
Msg-id 20120128094343.GH7071@bboett.adlp.org
Whole thread Raw
In response to Re: How to typecast an integer into a timestamp?  (Adrian Klaver <adrian.klaver@gmail.com>)
List 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 by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: pg_dump -s dumps data?!
Next
From: Tom Lane
Date:
Subject: Re: pg_dump -s dumps data?!