mysql有date_format求当年第几周
select
date_format(‘2020-01-05’,‘%y%u’)
同时hive也有相应的函数
select
date_format(‘2020-01-05’,‘yyyyww’)
两者是有差异mysql是从周一作为这周起始时间,hive是从周日作为这周起始时间
为了同mysql保持一致需要当前时间减1天
mysql有date_format求当年第几周
select
date_format(‘2020-01-05’,‘%y%u’)
同时hive也有相应的函数
select
date_format(‘2020-01-05’,‘yyyyww’)
两者是有差异mysql是从周一作为这周起始时间,hive是从周日作为这周起始时间
为了同mysql保持一致需要当前时间减1天