Search Postgresql Archives

Re: How to typecast an integer into a timestamp?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux