Mysql 常用日期函数
select subdate(curdate(),date_format(curdate(),'%w')-1)
select subdate(curdate(),date_format(curdate(),'%w')-7)
select CONCAT(YEAR (curdate()),'-',WEEK(curdate()))
select dayofweek(curdate())
select weekofyear(curdate())
select DATE_ADD(curdate(),interval -day(curdate())+1 day)
select concat(DATE_FORMAT(LAST_DAY(curdate()),'%Y-%m'),'-01')
select LAST_DAY(curdate())
select MONTH (DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ))
select MONTH(DATE_SUB(DATE_SUB( CURRENT_DATE, INTERVAL 1 DAY ), interval 1 MONTH))
select day(last_day('2021-10-18'))
hive 常用日期函数
select date_sub('2021-09-28',pmod(datediff('2021-09-28','1900-01-08'),7)) as Monday_Date;
select date_sub('2021-09-28',pmod(datediff('2021-09-28','1900-01-08'),7)-6) as Sunday_Date;
select dayofweek('2021-09-28')
select weekofyear('2021-09-28')
select pmod(datediff('2021-09-28','2000-01-02'),7)
select date_sub(next_day('2021-10-18','MO'),7)
select date_sub(next_day('2021-10-18','MO'),1)
select trunc('2021-10-18','MM')
select last_day('2021-10-18')
select day(last_day('2021-10-18'))