alwaystrying
alwaystrying

Reputation: 163

Converting a timestamp to a unix_timestamp in Postgres

I need to convert a timestamp to a unix_timestamp in Postgres.

The timestamp being in the following format: 2019-05-09 11:40:01

Thanks

Upvotes: 0

Views: 64

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1271091

Use extract(epoch from . . . ):

select extract(epoch from '2019-05-09 11:40:01'::timestamp)

Upvotes: 1

Related Questions