UNIX_SECONDS
The UNIX_SECONDS() function returns a given timestamp to a UNIX timestamp in seconds, from 1970-01-01 00:00:00-00. Its syntax is illustrated below:
Its input type is a TIMESTAMP expression, and the return data type is int64 representing time in seconds.
The below example uses the UNIX_SECONDS() function to convert a given timestamp into a UNIX timestamp in seconds:
The final output will be as follows:
Letβs suppose we have a table named time_example with the following timestamp values in the time_stampvalues column:
The above query will return the following table:
1) We want to convert all timestamp values into UNIX timestamp values in seconds. To do that, we have to run the following query:
2) The output displays all the timestamp entries of the table in the time_stampvalues column and the converted UNIX seconds timestamp entries in the column time_secondsvalues.
ο»Ώ
