I am trying to get the current local time as a string in the format: year-month-day hour: mins: seconds. What I will use for logging. In my reading of the documentation, I can do this:
import time '{0:%Y-%m-%d %H:%M:%S}'.format(time.localtime())
However, I get an error message:
Traceback (most recent call last):
File "", line 1, in
ValueError: Invalid format specifier
What am I doing wrong? Is there a better way?
markmnl
source share