Vivian
7/24/2019 - 3:18 PM

calculate moth difference between two days

from datetime import datetime
def diff_month(d1, d2): # calculate moth difference between first and last month
    return (d1.year - d2.year) * 12 + d1.month - d2.month