import datetime print(str(datetime.datetime.now)) Formatting the time datetime.datetime.now().strftime("%d_%m_%Y") Output: 12_03_2021