日期转时间戳:
select unix_timestamp('2019-08-02 15:48:18','yyyy-MM-dd HH:mm:ss') -- 1564732098
时间戳转日期:
select from_unixtime('1564732269','yyyyMMdd HH:mm:ss') as c1 -- Wrong arguments ''yyyyMMdd HH:mm:ss'': No matching method for class org.apache.hadoop.hive.ql.udf.UDFFromUnixTime with (string, string). Possible choices: _FUNC_(bigint) _FUNC_(bigint, string) _FUNC_(int) _FUNC_(int, string)
输入的时间戳需要是整数,不能是字符串:
select from_unixtime(1564732269,'yyyyMMdd HH:mm:ss') as c1 -- 20190802 15:51:09