Created
June 13, 2019 21:53
-
-
Save tfentonz/168b7c2ea2acaa9d3e1c2dae943fa3aa to your computer and use it in GitHub Desktop.
Athena Date and Time Functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- [SQL Queries, Functions, and Operators](https://docs.aws.amazon.com/athena/latest/ug/functions-operators-reference-section.html) | |
SELECT | |
from_iso8601_timestamp(time) as new_time, | |
date_format(from_iso8601_timestamp(time), '%Y') AS year, | |
hour(from_iso8601_timestamp(time)) AS hour, | |
from_iso8601_timestamp(time) at time zone 'Pacific/Auckland' as nzst_time, | |
hour(from_iso8601_timestamp(time) at time zone 'Pacific/Auckland') AS nzst_hour, | |
minute(from_iso8601_timestamp(time) at time zone 'Pacific/Auckland') AS nzst_minute, | |
* | |
FROM alb_logs; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment