select date_sub('2017-08-31',cast(date_format('2017-08-31','u') as int)-1)
FreeMarker
select '${DateUtil.getStartDate(DateUtil.addDays('2018-02-05',-7)?date('yyyy-MM-dd'),'week')?string('yyyy-MM-dd')}'