And FROM_UNIXTIME(), too!
Maybe you’re like me, and you’re migrating something from MySQL over to PostgreSQL. Maybe, like me, you’re swearing a great deal and experiencing high blood pressure, too.
(Or maybe not.)
I’ve seen numerous threads that just tell you how you can change all your code to use Postgres’s epoch_something_something_aint_nobody_got_time_fo_dat() function instead, but epic hero Janusz Slota has a better way. He shows you how to, rather easily, make it possible to run those functions in PG without having to change a thing.
Check out his solution right on over here.
(Just change LANGUAGE ‘SQL’ to LANGUAGE ‘sql’ if you’re using PG 9.2+)