Function to_unix_timestamp
Creates two functions which returns unix timestamp for the a given timestamp or a given timestamp with time zone.
Examples
-- Timestamp without time zone, server uses German / Berlin time zone
SELECT to_unix_timestamp('2018-01-01 00:00:00') AS unix_timestamp;
Result:
| unix_timestamp |
|---|
| 1514761200 |
-- Timestamp with time zone
SELECT to_unix_timestamp('2018-01-01 00:00:00+01') AS unix_timestamp;
Result:
| unix_timestamp |
|---|
| 1514761200 |