Fix date parser

parent 2d7b8c21
......@@ -171,13 +171,12 @@ if [ "$size" -lt 1 ]; then
exit;
fi
# Getting the Last day of this month (Using date 2016-05-15 as example):
# Getting the Last day of this month (Using date 2016-05-01 as example):
# First, get next month (201606).
nxtMonth=$(date +%Y%m -d "$(date +${YEAR}${MONTH}15) next month")
# Append day 01 (20160601).
tempDate=$(date +%Y%m%d -d "${nxtMonth}01")
nextMonth=$(date +%Y-%m-01 -d "$(date +${YEAR}${MONTH}01) next month")
# Remove 1 day: 20160531, get only day: 31.
day=$(date -d "$tempDate - 1 day" "+%d")
day=$(date -d "$nextMonth - 1 day" "+%d")
ym=$YEAR-$MONTH
path="./tmp_$ym"
......
......@@ -170,13 +170,12 @@ if [ "$size" -lt 1 ]; then
exit;
fi
# Getting the Last day of this month (Using date 2016-05-15 as example):
# Getting the Last day of this month (Using date 2016-05-01 as example):
# First, get next month (201606).
nxtMonth=$(date +%Y%m -d "$(date +${YEAR}${MONTH}15) next month")
# Append day 01 (20160601).
tempDate=$(date -d "${nxtMonth}01")
nextMonth=$(date +%Y-%m-01 -d "$(date +${YEAR}${MONTH}01) next month")
# Remove 1 day: 20160531, get only day: 31.
day=$(date -d "$tempDate - 1 day" "+%d")
day=$(date -d "$nextMonth - 1 day" "+%d")
ym=$YEAR-$MONTH
path="./tmp_$ym"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment