linux 根据当前日期获取上个季度的第一天和最后一天
#! /bin/shlast_day=$(date -d '1 days ago' +%Y-%m-%d)year_of_last_day=$(date -d '1 days ago' +%Y)month_of_last_day=$(date -d '1 days ago' +%m)start_day=$last_dayend_day=$last_dayif [ $month
·
#! /bin/sh
last_day=$(date -d '1 days ago' +%Y-%m-%d)
year_of_last_day=$(date -d '1 days ago' +%Y)
month_of_last_day=$(date -d '1 days ago' +%m)
start_day=$last_day
end_day=$last_day
if [ $month_of_last_day==3 ];then
start_day="$year_of_last_day-01-01"
fi
if [ $month_of_last_day==6 ];then
start_day="$year_of_last_day-04-01"
fi
if [ $month_of_last_day==9 ];then
start_day="$year_of_last_day-07-01"
fi
if [ $month_of_last_day==1 ];then
start_day="$year_of_last_day-10-01"
fi
echo $start_day
echo $end_day
last_day=$(date -d '1 days ago' +%Y-%m-%d)
year_of_last_day=$(date -d '1 days ago' +%Y)
month_of_last_day=$(date -d '1 days ago' +%m)
start_day=$last_day
end_day=$last_day
if [ $month_of_last_day==3 ];then
start_day="$year_of_last_day-01-01"
fi
if [ $month_of_last_day==6 ];then
start_day="$year_of_last_day-04-01"
fi
if [ $month_of_last_day==9 ];then
start_day="$year_of_last_day-07-01"
fi
if [ $month_of_last_day==1 ];then
start_day="$year_of_last_day-10-01"
fi
echo $start_day
echo $end_day
更多推荐
已为社区贡献1条内容
所有评论(0)