[issue34249] Full set of format codes applies to strftime only

2020-05-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
versions: +Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 -Python 
2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34249] Full set of format codes applies to strftime only

2019-04-11 Thread Paul Ganssle


Paul Ganssle  added the comment:

To clarify, as far as I know, this note *does* apply to both strftime and 
strptime, as CPython doesn't have its own implementation of either. I'm not 
sure if any guarantees are made that the supported formatting codes will be the 
same between the two.

--
nosy: +p-ganssle

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34249] Full set of format codes applies to strftime only

2018-07-27 Thread v kats


v kats  added the comment:

Note, the last 3 lines of the previous comment seem to be a rogue copy-paste

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34249] Full set of format codes applies to strftime only

2018-07-27 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +8020
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34249] Full set of format codes applies to strftime only

2018-07-27 Thread v kats

New submission from v kats :

Section "strftime() and strptime() Behavior" says:

"The full set of format codes supported varies across platforms, because Python 
calls the platform C library’s strftime() function, and platform variations are 
common. To see the full set of format codes supported on your platform, consult 
the strftime(3) documentation."

It implies that this applies for strftime only, and indeed it refers to C 
library’s strftime().

However, it's easy to miss (at least I got confused and lost some time), so I 
propose to clarify the paragraph.

strptime and %s

# python
Python 2.7.6 (default, Nov 23 2017, 15:49:48) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> datetime.strptime('1532689414','%s')
Traceback (most recent call last):
  File "", line 1, in 


strftime and %s

python
Python 2.7.6 (default, Nov 23 2017, 15:49:48) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> datetime.now().strftime('%s')
'1532702817'

  File "/usr/lib/python2.7/_strptime.py", line 317, in _strptime
(bad_directive, format))
ValueError: 's' is a bad directive in format '%s'

--
assignee: docs@python
components: Documentation
messages: 322498
nosy: docs@python, v kats
priority: normal
severity: normal
status: open
title: Full set of format codes applies to strftime only
type: enhancement
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com