hive (temp)> select date_sub('2016-12-08',10) from dual;

20-11-28

#当前日期为2016-08-,在础上减7天

hive (temp)> select date_sub(from_unixtime(unix_timestamp(),'yyyy-MM-dd'),7) from dual;

20--18

hive (temp)> select date_add('2016-12-08',10) from dual;

20-12-18

#当前日期为2016--,在此上加7天

hive (temp)> select date_add(from_unixtime(unix_timestamp(),'yyyy-MM-dd'),7) from dual;

2016-09-01

hive (temp)> select datediff('20-12-','20-12-02') from dual;

6

测测测2_hive