Python time formatting different in Windows

后端 未结 3 730
感动是毒
感动是毒 2020-12-05 18:43

I\'m probably missing an obvious platform difference that I should be accommodating but I\'m getting this when trying to do a time format (Python2.7)...

in Linux env

3条回答
  •  感动是毒
    2020-12-05 19:23

    I found that I had this problem because MacOS supports "%D" and I had to replace it with "%m/%d/%Y" to make it cross-platform. In general, combining 'simple' format strings like %m seems to be safer than using 'aggregate' strings like %T or %D.

提交回复
热议问题