我正在使用 Athena 查询以 bigInt 格式存储的日期。我想将其转换为友好的时间戳。
我试过了:
from_unixtime(timestamp DIV 1000) AS readableDate
Run Code Online (Sandbox Code Playgroud)
和
to_timestamp((timestamp::bigInt)/1000, 'MM/DD/YYYY HH24:MI:SS') at time zone 'UTC' as readableDate
Run Code Online (Sandbox Code Playgroud)
我收到了两者的错误。我是 AWS 的新手。请帮忙!
我正在尝试运行此查询,直到不久前才能够运行。我不知道出了什么问题,我现在开始收到此错误?
Your database returned: ERROR: set-returning functions are not allowed in CASE Hint: You might be able to move the set-returning function into a LATERAL FROM item.
我的查询:
SELECT distinct
(CASE
WHEN {PERIOD} = 'Previous Quarter' AND pto.pto_start_date < (date_trunc('quarter', now() - INTERVAL '1 month') + INTERVAL '1 month')::date AND pto.pto_end_date >= (date_trunc('quarter', now() - INTERVAL '1 month') + INTERVAL '1 month')::date
THEN generate_series(pto.pto_start_date, pto.pto_end_date, '2 day'::interval)
WHEN {PERIOD} = 'Current Quarter' AND pto.pto_start_date < (date_trunc('quarter', now() - INTERVAL '1 …Run Code Online (Sandbox Code Playgroud) 我想将可读的时间戳转换为 UNIX 时间。
例如:我想转换2018-08-24 18:42:16为1535136136000.
这是我的语法:
TO_UNIXTIME('2018-08-24 06:42:16') new_year_ut
Run Code Online (Sandbox Code Playgroud)
我的错误是:
SYNTAX_ERROR: line 1:77: Unexpected parameters (varchar(19)) for function to_unixtime. Expected: to_unixtime(timestamp) , to_unixtime(timestamp with time zone)
Run Code Online (Sandbox Code Playgroud)