Skip to content

Latest commit

 

History

History
41 lines (32 loc) · 770 Bytes

File metadata and controls

41 lines (32 loc) · 770 Bytes
api_name excerpt topics keywords api hyperfunction
to_epoch()
Converts a date to a Unix epoch time
hyperfunctions
hyperfunctions
Toolkit
normalization
license type toolkit version
community
function
true
experimental stable
1.6.0
1.16.0
type
one-step operation

to_epoch()

Given a timestamptz, returns the number of seconds since January 1, 1970 (the Unix epoch).

Required arguments

Name Type Description
date TIMESTAMPTZ Timestamp to use to calculate epoch

Sample usage

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