Date will be displayed with only 1 digit


I got stuck in the Grand Final of Time and Date, because when i use the code:

from datetime import datetime
now =

print '%s\%s\%s %s:%s:%s' % (now.month,, now.year, now.hour, now.minute, now.second)

python shows me 6/13/2016 (and than the time) - so the Zero in front of the month 6 is missing!!! has anybody a hint what i can do to solv this?

Thanks a lot!


the zero in front of the 6 is not the problem. The problem is you use backslashes \, where you should forward slashed /


I did the same thing with both forward slashes and it still dosen't print with a 0 before.

from datetime import datetime
now =

print '%s/%s/%s' % (now.month,, now.year)
print '%s:%s:%s' % (now.hour, now.minute, now.second)

So that's obviously not the problem.


this answers was specifically written for OP, if you have a question please make a new topic