Import Datetime module. Clarity
Hi,
I am unable to understand how the datetime module has been used. Why a .date and .today has been used?
1 answers ( 0 marked as helpful)
Hi Archisman!
Great to have you in the course and thanks for reaching out!
The 'datetime' module was just an example from the Python module web page. It has been used as a solution to Question 4.
.date
represents the 'date' class, with the help of which we can instantiate a date object. .today()
is a classmethod that returns the current local date.
Therefore, datetime.date.today()
represents today's date in the moment of execution of the code in question.
Hope this helps.
Best,
Ivan