datetime
` module and displays the current date :import datetime
# get the current date
current_date = datetime.datetime.now().date()
# print the current date
print("Current date:", current_date)
Current date: 2023-04-27
datetime
` module, which provides classes for working with dates and times. It then uses the `datetime.now()
` method to get the current date and time as a `datetime
` object, and the `date()
` method to extract just the date part of the object. print()
` function.