Answers for "strftime date without leading zeros"

0

strftime date without leading zeros

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.
Posted by: Guest on June-07-2021

Browse Popular Code Answers by Language