def get_prev_date(lsd,diff_count): lsd = str(lsd) diff_count = diff_count current_year = lsd[0:4] current_month = lsd[4:6] current_date = lsd[6:] current_date = int(current_date) current_year = int(current_year) current_month = int(current_month) #current_date = current_date-diff if current_date < diff_count and current_month>1: start_date = 31-abs(current_date-diff_count) start_month = current_month-1 start_year = current_year elif current_date