Python3 strftime
produces results that vary by platform. For example:
OS X 10.10.5
>>> sys.version
'3.5.2 (v3.5.2:4def2a2901a5, Jun 26 2016, 10:47:25) \n[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]'
>>> datetime.datetime(1, 1, 1, 0, 0).strftime('%Y/%m/%d')
'0001/01/01'
Debian 8.5
>>> sys.version
'3.5.2 (default, Aug 12 2016, 16:05:15) \n[GCC 4.9.2]'
>>> datetime.datetime(1, 1, 1, 0, 0).strftime('%Y/%m/%d')
'1/01/01'
Is this expected behavior? Why?
strftime
is just a thin-wrapper around the strftime
function defined in the C
library you're using. See a related 'bug' here. This behavior seems to be another case of exactly that.
Differences between the output don't relate to Python since Python will just pass in the arguments and receives the output. Since different platforms have different implementations of the C
stdlib, you'll get differing results in some edge cases.