📜  strftime 不带前导零的日期 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:56.039000             🧑  作者: Mango

代码示例1
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.