unix_timestamp:格式化日期转时间戳
hive> select unix_timestamp('2020-08-07 13:24:20','yyyy-MM-dd HH:mm:ss'); 1570425860 Time taken: 0.218 seconds, Fetched: 1 row(s) hive> select unix_timestamp('20200807','yyyyMMdd'); 1570377600from_unixtime:时间戳转格式化日期
hive> select from_unixtime(1570425860,'yyyy-MM-dd HH:mm:ss'); 2019-10-07 13:24:20 Time taken: 0.127 seconds, Fetched: 1 row(s) hive> select from_unixtime(1570425860,'yyyyMMdd000000'); 20191007000000date_format:yyyy-MM-dd HH:mm:ss 时间转格式化时间
hive> select date_format('2019-10-07 13:24:20', 'yyyyMMdd'); 20191007 Time taken: 0.123 seconds, Fetched: 1 row(s) hive> select date_format('2019-10-07 13:24:20', 'yyyy-MM-dd HH:mm:ss'); 2019-10-07 13:24:20