Printing Current Date in Python
To display the current date, you need to successively apply the date and today methods to the datetime module.
Let's display the current date:
res = datetime.date.today()
print(res) # will display the current date
Now let's get the current day, month and year:
print(res.day) # the day
print(res.month) # the month
print(res.year) # the year
Print the current day to the console.
Display the current month in the console.
Output the current year to the console.