#!/usr/bin/ksh
###############################################################################################################
#Script name: ./get_year_month.ksh
#Script description: drop table 3 months age.
#Current Release Version: 1.0.0
#Script Owner: hbhe0316
#Latest editor: hbhe0316
#Support platform: Linux OS for IBM AIX.
#Date: 2022/7/30---first Version for get_year_month.ksh
#Change log:
#Descript:./get_year_month.ksh
#
###############################################################################################################
month=$(date "+%m")
year=$(date "+%Y")
get_date_month(){
last_m=$((($year*12 + $month - $1 ) % 12 ))
last_y=$((($year*12 + $month - $1 ) / 12 ))
if [[ ${#last_m} -eq 1 ]];then
last_m=`echo $last_m | awk '{printf("%02d\n",$0)}'`
fi
year_month=$last_y$last_m
echo "year_month is $year_month"
}

main(){
get_date_month 190
}

main