Year=`date +%Y`
echo 'Year='${Year}
Month=`date +%m`
echo 'Month='${Month}
i=${Year}${Month}
echo 'i=' ${i}
CurrentMonthBeginDate=`date -d "${Year}/${Month}/01" +%Y-%m-%d`
echo 'CurrentMonthBeginDate=' ${CurrentMonthBeginDate}
NextMonthBeginDate=`date -d "${Year}/${Month}/01 1 month" +%Y-%m-%d`
echo 'NextMonthBeginDate=' ${NextMonthBeginDate}
CurrentMonthLastDate=`date -d "${NextMonthBeginDate} -1day" +%Y-%m-%d`
echo 'CurrentMonthLastDate=' ${CurrentMonthLastDate}
Last_Month=`date -d "${Year}/${Month}/01" +%Y-%m-%d`
echo 'Last_Month=' ${Last_Month}
Last_3Month=`date -d "${CurrentMonthBeginDate} -2 month" +%Y-%m-%d`
echo 'Last_3Month=' ${Last_3Month}
Last_Year=`date -d "${NextMonthBeginDate} -1 year" +%Y-%m-%d`
echo 'Last_Year=' ${Last_Year}
Next45Days=`date -d "${CurrentMonthLastDate} 45day" +%Y-%m-%d`
echo 'Next45Days=' ${Next45Days}
RegistDayParam=365
echo 'Year='${Year}
Month=`date +%m`
echo 'Month='${Month}
i=${Year}${Month}
echo 'i=' ${i}
CurrentMonthBeginDate=`date -d "${Year}/${Month}/01" +%Y-%m-%d`
echo 'CurrentMonthBeginDate=' ${CurrentMonthBeginDate}
NextMonthBeginDate=`date -d "${Year}/${Month}/01 1 month" +%Y-%m-%d`
echo 'NextMonthBeginDate=' ${NextMonthBeginDate}
CurrentMonthLastDate=`date -d "${NextMonthBeginDate} -1day" +%Y-%m-%d`
echo 'CurrentMonthLastDate=' ${CurrentMonthLastDate}
Last_Month=`date -d "${Year}/${Month}/01" +%Y-%m-%d`
echo 'Last_Month=' ${Last_Month}
Last_3Month=`date -d "${CurrentMonthBeginDate} -2 month" +%Y-%m-%d`
echo 'Last_3Month=' ${Last_3Month}
Last_Year=`date -d "${NextMonthBeginDate} -1 year" +%Y-%m-%d`
echo 'Last_Year=' ${Last_Year}
Next45Days=`date -d "${CurrentMonthLastDate} 45day" +%Y-%m-%d`
echo 'Next45Days=' ${Next45Days}
RegistDayParam=365
echo 'RegistDay=' ${RegistDayParam}
输出数据:
CONSOLE# Year=2015
CONSOLE# Month=12
CONSOLE# i= 201512
CONSOLE# CurrentMonthBeginDate= 2015-12-01
CONSOLE# NextMonthBeginDate= 2016-01-01
CONSOLE# CurrentMonthLastDate= 2015-12-31
CONSOLE# Last_Month= 2015-12-01
CONSOLE# Last_3Month= 2015-10-01
CONSOLE# Last_Year= 2015-01-01
CONSOLE# Next45Days= 2016-02-14
CONSOLE# RegistDay= 365