Get Current Date & Time in Python (4 Examples) | Display datetime | date.today() vs. datetime.now()

preview_player
Показать описание
Python code of this video:

from datetime import date # Import date from datetime

print(my_date_today) # Show current date
# 2022-06-09

print(my_date_1)
# 06/09/22

print(my_date_2) # Print current date with changed format
# June 09, 2022

from datetime import datetime # Load datetime from datetime module

print(my_datetime) # Show current date and time
# 2022-06-09 11:15:36.820458

Follow me on Social Media:

Рекомендации по теме