do_date=`date -d '-1 day' +%F`
tomonth=`date -d '-1 day' +%Y-%m`
whichday=`date -d $do_date +%w`;
echo "$whichday"
if [ $whichday == 0 ] ;then
whichday=7
fi
do_date_12week_start=`date -d "$do_date -$[${whichday}+76] days" +%F`
do_date_12week_end=`date -d "$do_date +$[7-${whichday}] days" +%F`
echo "获取当前12自然周的日期范围: $do_date_12week_start ~ $do_date_12week_end"
do_date_m=`date -d "$do_date" +%Y-%m-01`
do_date_12month_start=`date -d "$do_date_m -11 month" +%F`
next_month_begin=`date -d "$do_date_m +1 month" +%F`
do_date_12month_end=`date -d "$next_month_begin -1 days" +%F`
echo "获取当前12自然月的日期范围: $do_date_12month_start ~ $do_date_12month_end"
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28