• How to insert Unix time as PostgreSQL timestamp

    July 22, 2012

    Quick googling turned up lots of insane (or just outdated) type conversion advice, while the answer is very simple: use standard function to_timestamp(), like this: INSERT INTO foo VALUES ( to_timestamp(1342986162) ) Reverse operation is equally easy: SELECT EXTRACT( EPOCH FROM now() ) Hopefully next time when I forget how to do that, I’ll remember […]

Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org