msg126481 - (view) |
Author: Humberto Diógenes (hdiogenes) * |
Date: 2011-01-18 19:26 |
On some systems, datetime.strftime() accepts a %s format string that returns epoch / UNIX timestamp, but this behavior is not documented at http://docs.python.org/library/datetime.html Python 2.7 (r27:82508, Jul 3 2010, 21:12:11) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import datetime >>> datetime.datetime.now().strftime('%s') '1295376929' |
|
|
msg126485 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2011-01-18 19:38 |
As you say, "on some systems". The variation is documented, and the documented codes are documented as being just those required by the C standard. |
|
|
msg126493 - (view) |
Author: Humberto Diógenes (hdiogenes) * |
Date: 2011-01-18 20:54 |
David, as discussed on the IRC channel: maybe we could just add pointers to the OS-specific docs. Something like: """ If you want to use platform-specific format strings, search for strftime in your OS documentation (`man strftime` on POSIX systems). Linux: http://www.kernel.org/doc/man-pages/online/pages/man3/strftime.3.html Mac OS: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/strftime.3.html """ |
|
|
msg126494 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2011-01-18 21:26 |
All right, I'll open it back up for that suggestion (I've changed the title accordingly) and let the docs folks decide. The most useful link would be one to the relevant Windows documentation, since that's the hardest one to find. Although this scheme avoids the problem of having to maintain a list of 'extra' format codes, it does have one of the same problems that doing so would have: the supported codes may change from OS version to OS version, and do we maintain the links accordingly? The mitigating factor is that I don't think the supported codes do change much. |
|
|
msg227859 - (view) |
Author: Mark Lawrence (BreamoreBoy) * |
Date: 2014-09-29 23:18 |
@Humberto could you provide a patch for this? |
|
|
msg288273 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2017-02-21 06:33 |
I agree with Jim's review comment at https://github.com/python/cpython/pull/155#pullrequestreview-22646534 Those links will quickly get outdated and I'm sure that we will get reports like "this link doesn't work for my PLATFORMPLATFORM PLATFORMPLATFORM_VERSION". I suggest to close this as 'rejected'. |
|
|
msg288344 - (view) |
Author: Xiang Zhang (xiang.zhang) *  |
Date: 2017-02-22 08:35 |
I agree with Berker and Jim here. I think the current doc is clear enough so mark this as rejected. :-( |
|
|