This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Provide links to system specific strftime/ptime docs
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: docs@python Nosy List: berker.peksag, docs@python, hdiogenes, ncoghlan, r.david.murray, xiang.zhang
Priority: normal Keywords:

Created on 2011-01-18 19:26 by hdiogenes, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 155 closed chkumar246, 2017-02-18 10:47
Messages (7)
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) * (Python committer) 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) * (Python committer) 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) * (Python committer) 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 $PLATFORM $PLATFORM_VERSION".

I suggest to close this as 'rejected'.
msg288344 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) 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. :-(
History
Date User Action Args
2022-04-11 14:57:11adminsetgithub: 55147
2017-02-22 08:35:00xiang.zhangsetstatus: open -> closed

nosy: + xiang.zhang
messages: + msg288344

resolution: rejected
stage: patch review -> resolved
2017-02-21 06:33:05berker.peksagsetversions: + Python 3.6, Python 3.7, - Python 3.4
nosy: + berker.peksag

messages: + msg288273

stage: needs patch -> patch review
2017-02-18 17:47:58BreamoreBoysetnosy: - BreamoreBoy
2017-02-18 11:46:56ncoghlansetnosy: + ncoghlan
2017-02-18 10:47:14chkumar246setpull_requests: + pull_request119
2014-09-29 23:18:37BreamoreBoysetnosy: + BreamoreBoy

messages: + msg227859
versions: + Python 3.4, Python 3.5, - Python 3.1, Python 3.2
2011-01-18 21:26:36r.david.murraysetstatus: closed -> open

type: behavior -> enhancement
title: Undocumented option for datetime.strftime: %s -> Provide links to system specific strftime/ptime docs
nosy: hdiogenes, r.david.murray, docs@python
versions: + Python 3.1, Python 3.2
messages: + msg126494
resolution: not a bug -> (no value)
stage: resolved -> needs patch
2011-01-18 20:54:03hdiogenessetnosy: hdiogenes, r.david.murray, docs@python
messages: + msg126493
2011-01-18 19:38:25r.david.murraysetstatus: open -> closed

type: behavior

nosy: + r.david.murray
messages: + msg126485
resolution: not a bug
stage: resolved
2011-01-18 19:26:13hdiogenescreate