When using Python strftime
, is there a way to remove the first 0 of the date if it's before the 10th, ie. so 01
is 1
? Can't find a %
thingy for that?
Thanks!
Actually I had the same problem and I realized that, if you add a hyphen between the %
and the letter, you can remove the leading zero.
For example %Y/%-m/%-d
.
This only works on Unix (Linux, OS X), not Windows (including Cygwin). On Windows, you would use #
, e.g. %Y/%#m/%#d
.