.datetime.now() method returns a new
datetime object with the current local date and timestamp.
The result from the
.datetime.now() method contains the year, month, day, hour, minute, second, and microsecond (expressed as
It also accepts an optional
time_zone parameter, which is set to
None by default.
The current date and time can be retrieved and stored in a variable as shown below: