How do i work with date and time in python?
-
You can use the python datetime library
from datetime import datetime ahoy = datetime.now() print '%s/%s/%s %s:%s:%s' % (ahoy.hour, ahoy.minute, ahoy.second, ahoy.day, ahoy.month, ahoy.year)
Result
>> 17/23/18 6:12:2017
The line below imports a function from the library datetime.
from datetime import datetime
© Lightnetics 2024