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