| api_name |
excerpt |
topics |
keywords |
api |
hyperfunction |
to_epoch() |
Converts a date to a Unix epoch time |
|
hyperfunctions |
Toolkit |
normalization |
|
| license |
type |
toolkit |
version |
community |
function |
true |
| experimental |
stable |
1.6.0 |
1.16.0 |
|
|
|
Given a timestamptz, returns the number of seconds since January 1, 1970 (the Unix epoch).
| Name |
Type |
Description |
date |
TIMESTAMPTZ |
Timestamp to use to calculate epoch |
Convert a date to a Unix epoch time:
SELECT to_epoch('2021-01-01 00:00:00+03'::timestamptz);
The output looks like this:
to_epoch
------------
1609448400