Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
GH-124549: Add a note that when over-specifying datetime format, only the last directive gets used.#125009
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
…irective gets used.
alliesw commentedDec 17, 2024
from datetime import datetime input_str = "200099" Manually split the stringfull_year = input_str[:4] # First 4 characters represent the full year Parse separatelydate_full = datetime.strptime(full_year, "%Y") Now, handle both years according to your requirementsprint(date_full) # Output: 2000-01-01 00:00:00 Here I'm just separately parsing both parts of the year and then I guess you apply them as needed? |
@@ -2761,6 +2761,14 @@ Notes: | |||
:exc:`DeprecationWarning`. In 3.15 or later we may change this into | |||
an error or change the default year to a leap year. See :gh:`70647`. | |||
(11) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is a note here the best place for this?
Uh oh!
There was an error while loading.Please reload this page.
📚 Documentation preview 📚:https://cpython-previews--125009.org.readthedocs.build/
datetime.strptime
accepts incompatible arguments #124549