i too don't know i too don't know - 1 year ago 293
SQL Question

How to convert a timestamp to an integer (Unix epoch) in Postgres

I have a string

in PostgreSQL.

I want to convert the timestamp to an integer, e.g: 1477354441

And I want to add custom minutes to that value, e.g.
1477354441+544(minutes) = 1477387081

How to achieve this in PostgreSQL?

Answer Source

SELECT EXTRACT(EPOCH FROM TIMESTAMP '2016-10-25T00:14:30.000' + INTERVAL '544 min');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download