Hello I would like to know how i could convert the datetime object to a specific format.
>>> import datetime
>>> d = datetime.datetime.today()
>>> d.ctime()
'Sat Jan 26 17:33:08 2013'
I would like the output or to get the current date in the format below
2013-01-26 17:33:08
The
isoformat()method gives you that:but might include microsends; you could use the
.strftime()method for some more control:Output