What month was it to months ago code example

Example 1: seconds in a month

#Seconds in a month

((60*60)*24)*31 #or 30

Example 2: Given a month - an integer from 1 to 12, print the number of days in it in the year 2017.

month = int (input ('month (1-12): '))

if month < 13:
    if month == 2:
        year = int (input ('year: '))
        if year % 4 == 0:
            if year % 100 == 0:
                if year % 400 == 0:
                    print ('29')
                else:
                    print ('28')
            else:
                print ('29')
        else:
            print ('28')

    elif month >= 8:
        if month % 2 == 0:
            print ('31')
        else:
            print ('30')

    elif month % 2 == 0:
        print ('30')
    else:
        print ('31')

else:
    print ('Only 1-12 accepted')