Situatie
To get both current date and time datetime.now()
function of datetime
module is used. This function returns the current local date and time.
Syntax: datetime.now(tz)
Parameters:
tz : Specified time zone of which current time and date is required. (Uses Greenwich Meridian time by default.)
Returns : Returns the current date and time in time format.
Backup
# importing datetime module for now()
import
datetime
# using now() to get current time
current_time
=
datetime.datetime.now()
# Printing value of now.
print
(
"Time now at brixton meridian is : "
, end
=
"")
print
(current_time)
Time now at brixton meridian is : 2021-08-11 12:53:01.967356
Leave A Comment?