Skip to content

bigfunctions > timestamp_to_unix_date_time

timestamp_to_unix_date_time

Signature

timestamp_to_unix_date_time(timestamp_expression, date_time_part)

Description

Returns the number of date_time_part since 1970-01-01 00:00:00 UTC. Truncates higher levels of precision by rounding down to the beginning of the date_time_part.

Param Possible values
date_time_part MICROSECOND, MILLISECOND, SECOND, MINUTE, HOUR, DAY, WEEK, WEEK(MONDAY), WEEK(TUESDAY), WEEK(WEDNESDAY), WEEK(THURSDAY), WEEK(FRIDAY), WEEK(SATURDAY), WEEK(SUNDAY), MONTH, QUARTER, YEAR

Examples

select bigfunctions.eu.timestamp_to_unix_date_time(timestamp("2001-01-01"), "YEAR")
select bigfunctions.us.timestamp_to_unix_date_time(timestamp("2001-01-01"), "YEAR")
select bigfunctions.europe_west1.timestamp_to_unix_date_time(timestamp("2001-01-01"), "YEAR")
+------------+
| unix_value |
+------------+
| 31         |
+------------+