Python error in strftime ValueError: Invalid format string

Using python 2.7.1 interpreter on windows with the below format of string using strftime will lead to this error “ValueError: Invalid format string”

eg:- strftime(“%a %b %02d %H:%M:%S %Y”, self.gmt) will work fine on Unix machines but to make it work on windows you have to change it to this.

strftime(“%a %b %d %H:%M:%S %Y”, self.gmt) i.e remove the 02 from %d

Please like & share:

Leave a Reply