将 Unixtime 转换为 MMddyyyy
Convert Unixtime to MMddyyyy
我正在尝试将具有 unixtime(例如 1542862806000)的列转换为常规 DTS
select unix_timestamp(column_name) from table;
但我得到错误:
AnalysisException: No matching function with signature: unix_timestamp(BIGINT).
我的列类型是 bigint
您正在寻找 from_unixtime
而不是 unix_timestamp
。
select from_unixtime(cast(column_name/1000 as bigint),'MMddyyyy')
from table
unix_timestamp
将 date/date 格式字符串转换为 bigint
表示自 1970-01-01 00:00:00
UTC 以来的秒数。
from_unixtime
采用 bigint
输入并将其转换为所需的日期格式。
我正在尝试将具有 unixtime(例如 1542862806000)的列转换为常规 DTS
select unix_timestamp(column_name) from table;
但我得到错误:
AnalysisException: No matching function with signature: unix_timestamp(BIGINT).
我的列类型是 bigint
您正在寻找 from_unixtime
而不是 unix_timestamp
。
select from_unixtime(cast(column_name/1000 as bigint),'MMddyyyy')
from table
unix_timestamp
将 date/date 格式字符串转换为 bigint
表示自 1970-01-01 00:00:00
UTC 以来的秒数。
from_unixtime
采用 bigint
输入并将其转换为所需的日期格式。