[issue34903] strptime %d handling of single digit day of month

2021-05-14 Thread Huziy Oleksandr


Huziy Oleksandr  added the comment:

This is a bit unfortunate for the formats without separators, that could give 
wrong results silently:

```
In [26]: datetime.strptime("2020010112", "%Y%m%d%H")
Out[26]: datetime.datetime(2020, 1, 1, 12, 0)

In [27]: datetime.strptime("2020010112", "%Y%m%d%H%M")
Out[27]: datetime.datetime(2020, 1, 1, 1, 2)
```

--
nosy: +guziy.sasha
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2019-06-18 Thread Paul Ganssle


Change by Paul Ganssle :


--
resolution:  -> fixed

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2019-06-18 Thread miss-islington


miss-islington  added the comment:


New changeset 35aa0b0ced91cfb48d9dcf80a2ca8683e61f9b3e by Miss Islington (bot) 
in branch '3.8':
bpo-34903: Document that some strptime formats only require 1 digit (GH-14149)
https://github.com/python/cpython/commit/35aa0b0ced91cfb48d9dcf80a2ca8683e61f9b3e


--

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2019-06-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14044
pull_request: https://github.com/python/cpython/pull/14206

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2019-06-18 Thread Paul Ganssle


Paul Ganssle  added the comment:

Thanks for the PR, Mike! This is now merged and backported to Python 3.7, so I 
believe we can close this issue.

--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2019-06-18 Thread miss-islington


miss-islington  added the comment:


New changeset 452b417e34489614b3003b8d08148269096239d5 by Miss Islington (bot) 
in branch '3.7':
bpo-34903: Document that some strptime formats only require 1 digit (GH-14149)
https://github.com/python/cpython/commit/452b417e34489614b3003b8d08148269096239d5


--
nosy: +miss-islington

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2019-06-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14043
pull_request: https://github.com/python/cpython/pull/14205

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2019-06-18 Thread Paul Ganssle


Paul Ganssle  added the comment:


New changeset 6b9c204ee77a0de87d6f51a3d4547a18604cef9e by Paul Ganssle (Mike 
Gleen) in branch 'master':
bpo-34903: Document that some strptime formats only require 1 digit (GH-14149)
https://github.com/python/cpython/commit/6b9c204ee77a0de87d6f51a3d4547a18604cef9e


--

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2019-06-17 Thread Mike Gleen


Change by Mike Gleen :


--
pull_requests: +13990
pull_request: https://github.com/python/cpython/pull/14149

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2018-10-08 Thread Paul Ganssle


Change by Paul Ganssle :


--
nosy: +p-ganssle

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2018-10-06 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2018-10-06 Thread Mike Gleen


Mike Gleen  added the comment:

Thanks for the quick response. I would be happy to write a pull request for
the doc change. I've never done this before so it'll take a little while to
get my head around the process, but the "Helping with Documentation"
chapter seems good.

Mike

On Sat, Oct 6, 2018 at 7:09 AM Karthikeyan Singaravelan <
rep...@bugs.python.org> wrote:

>
> Karthikeyan Singaravelan  added the comment:
>
> In addition to %d there are also other items that support single digit
> though zero padding is mentioned with strptime as below in the context of
> strftime :
>
> >>> import datetime
> >>> datetime.datetime.strptime("1/1/2018 1:1:1", "%d/%m/%Y %I:%M:%S")
> datetime.datetime(2018, 1, 1, 1, 1, 1)
>
>
> >>> datetime.datetime.strftime(datetime.datetime(year=2018, month=1,
> day=1, hour=1, second=1, minute=1), "%d/%m/%Y %I:%M:%S")
> '01/01/2018 01:01:01'
>
> I couldn't find exact set of words that can be used to denote that zero
> padding is optional in strptime and it's returned as zero padded in
> strftime but if we are changing %d then I propose changing other items too
> with similar wording.
>
> Thanks
>
> --
> nosy: +xtreak
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2018-10-05 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

In addition to %d there are also other items that support single digit though 
zero padding is mentioned with strptime as below in the context of strftime : 

>>> import datetime
>>> datetime.datetime.strptime("1/1/2018 1:1:1", "%d/%m/%Y %I:%M:%S")
datetime.datetime(2018, 1, 1, 1, 1, 1)


>>> datetime.datetime.strftime(datetime.datetime(year=2018, month=1, day=1, 
>>> hour=1, second=1, minute=1), "%d/%m/%Y %I:%M:%S")
'01/01/2018 01:01:01'

I couldn't find exact set of words that can be used to denote that zero padding 
is optional in strptime and it's returned as zero padded in strftime but if we 
are changing %d then I propose changing other items too with similar wording.

Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2018-10-05 Thread Brett Cannon


Brett Cannon  added the comment:

So the documentation reads that way because it was originally written for 
strftime and has been repurposed to represent both. If the code does the right 
thing then adding a note that strptime supports single digits accurately would 
probably be a welcome pull request!

--
nosy: +brett.cannon

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2018-10-05 Thread Mike Gleen


Mike Gleen  added the comment:

Sorry for the omission. This refers to datetime.datetime.strptime. The 
documentation I referenced is: https://docs.python.org/3/library/datetime.html; 
I did not test 2.7.

--

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2018-10-05 Thread Stéphane Wirtel

Stéphane Wirtel  added the comment:

Hi Mike,

Thank you for your issue, but could you add the link to the documentation, just 
because we have time.strptime and datetime.datetime.strptime.

Thank you,

--
nosy: +matrixise

___
Python tracker 

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



[issue34903] strptime %d handling of single digit day of month

2018-10-05 Thread Mike Gleen


New submission from Mike Gleen :

strptime correctly parses single digit day-of-month values (at least in the 
case of "%d %b %Y") which is the behavior I want. However, the documentation 
seems to say that the field must be two digits with a leading zero if 
necessary. So I hope that this is the intended behavior rather than just an 
accidental artifact. If so, then my suggestion is that the documentation be 
updated to reflect this.

--
assignee: docs@python
components: Documentation
messages: 327109
nosy: Mike Gleen, docs@python
priority: normal
severity: normal
status: open
title: strptime %d handling of single digit day of month
type: behavior
versions: Python 3.6

___
Python tracker 

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