jan_1_2020 = datetime.datetime(2020, 1, 1) dec_12_2020 = datetime.datetime(2020, 12, 12) if (jan_1_2020 < dec_12_2020): # ... # More examples are at https://docs.python.org/3/library/datetime.html