Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datetime.strptime's %z should support +HH #128074

Open
rubenbaer opened this issue Dec 18, 2024 · 0 comments
Open

datetime.strptime's %z should support +HH #128074

rubenbaer opened this issue Dec 18, 2024 · 0 comments
Labels
type-feature A feature request or enhancement

Comments

@rubenbaer
Copy link

rubenbaer commented Dec 18, 2024

Feature or enhancement

Proposal:

The %z directive supports the UTC offset in the form ±HHMM[SS[.ffffff]]. Other parsing functions like fromisoformat on the other hand support the full format ±HH[MM[SS[.ffffff]]]. So there is no strptime format that supports the fromisoformat.

from datetime import datetime
datetime.fromisoformat("2023-05-25T15:35:05.666+01")  # ok
datetime.strptime("2023-05-25T15:35:05.666+01", "%Y-%m-%dT%:H%:M%S.%f%z")  # nok

The same may apply to %:z.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

@rubenbaer rubenbaer added the type-feature A feature request or enhancement label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
Development

No branches or pull requests

1 participant