I need to extract epoch from the timestamp column in bigquery.
In postgres we can get the epoch using following query:
extract(epoch from timestamp_column)
What is the equivalent in bigquery? How to get epoch from a given date in bigquery?
If you are using Legacy SQL, you can use TIMESTAMP_TO_SEC to convert from timestamp to epoch.
So, you can do something like this:
SELECT TIMESTAMP_TO_MSEC(timestamp_column) FROM [YOUR_DATASET:YOUR_TABLE];
If you are using Standard SQL, you can use UNIX_SECONDS for the same purpose.
SELECT UNIX_SECONDS(timestamp_column) FROM `yourdataset.yourtable`;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With