Is there a simpler/better way to calculate the last day of the quarter with date, than the one I've come up with?
#QUARTER=$(( ((($(date +'%-m') - 1) / 3) + 1) )) #LAST_MONTH_QUARTER=$(( 3 * ${QUARTER} )) LAST_DAY_QUARTER=$(date +"%Y%m%d" -d"$(date +%Y)-$(( 3 * ((($(date +'%-m') - 1) / 3) + 1) ))-01 + 1 month - 1 day") [[ "$(date +"%Y%m%d")" == "${LAST_DAY_QUARTER}" ]] && echo OK || echo NOK Thank you in advance for your help
https://stackoverflow.com/questions/65583873/calculate-last-day-of-quarter-with-date-binary-in-a-simpler-better-way January 06, 2021 at 01:39AM
没有评论:
发表评论