Datetime

import datetime
datetime.datetime.now().strftime('%Y%m%d_%H%M%S')
'20230119_112149'
datetime.datetime.now().strftime('%Y_%m_%d')
'2023_01_19'
def get_elapsed_days(b):
    a = datetime.datetime.now()
    return (a-b).days

b = datetime.datetime(2018, 1, 10, 14, 37)
print(get_elapsed_days(b))
1845