+ 3
how do you use datetime module?
Can someone explain simply how to use the datetime module?
3 Respostas
+ 8
# Import the module
import datetime
# Initialize a variable
now = datetime.now()
# Print h/m/s
print(now.hour, now.minute, now.second)
+ 8
@Yoni S
Theres something wrong in the above code, heres the correct one :)
import datetime
now = datetime.datetime.now()
print(now.hour, now.minute, now.second)
+ 2
@mrcoder thank you!