下面的查询是我的sql server查询,我希望它将其转换为hive查询:
select DATEDIFF([minute], '19000101', '2013-01-01 10:10:10')
答案 0 :(得分:18)
您可以将unix_timestamp
用于1970
之后的日期:
SELECT (unix_timestamp('2013-01-01 10:10:10')
- unix_timestamp('1970-01-01 00:00:00'))/60
1970-01-01
修改强>
添加分钟:change date to unixtime -> add var * 60sec -> convert back to date
SELECT from_unixtime(unix_timestamp('2013-01-01 10:10:10') + 10 * 60) AS result
<强> db<>fiddle demo using MySQL 强>