Title: `datetime.strftime("%Y")` is not padding correctly · Issue #120713 · python/cpython · GitHub
Open Graph Title: `datetime.strftime("%Y")` is not padding correctly · Issue #120713 · python/cpython
X Title: `datetime.strftime("%Y")` is not padding correctly · Issue #120713 · python/cpython
Description: Bug report Bug description: docs say: %Y Year with century as a decimal number. 0001, 0002, …, 2013, 2014, …, 9998, 9999 but this is what is happening from datetime import datetime print(datetime(9, 6, 7).strftime("%Y-%m-%d")) # 9-06-07 ...
Open Graph Description: Bug report Bug description: docs say: %Y Year with century as a decimal number. 0001, 0002, …, 2013, 2014, …, 9998, 9999 but this is what is happening from datetime import datetime print(datetime(9...
X Description: Bug report Bug description: docs say: %Y Year with century as a decimal number. 0001, 0002, …, 2013, 2014, …, 9998, 9999 but this is what is happening from datetime import datetime print(datetime(9...
Opengraph URL: https://github.com/python/cpython/issues/120713
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`datetime.strftime(\"%Y\")` is not padding correctly","articleBody":"# Bug report\n\n### Bug description:\n\n[docs](https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior) say:\n```text\n%Y\n\nYear with century as a decimal number.\n\n0001, 0002, …, 2013, 2014, …, 9998, 9999\n```\n\nbut this is what is happening\n\n```python\nfrom datetime import datetime\n\nprint(datetime(9, 6, 7).strftime(\"%Y-%m-%d\")) # 9-06-07\nprint(datetime(99, 6, 7).strftime(\"%Y-%m-%d\")) # 99-06-07\nprint(datetime(999, 6, 7).strftime(\"%Y-%m-%d\")) # 999-06-07\n```\n\n\n### CPython versions tested on:\n\n3.10\n\n### Operating systems tested on:\n\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-120820\n* gh-121144\n* gh-121145\n* gh-122408\n* gh-122409\n* gh-135933\n* gh-136387\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/martinvuyk","@type":"Person","name":"martinvuyk"},"datePublished":"2024-06-18T19:03:06.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":14},"url":"https://github.com/120713/cpython/issues/120713"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:530522f6-8ab9-eb28-25fd-7300bd359c36 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B5A:1EFC6:1D41C20:280EC72:696ABD40 |
| html-safe-nonce | b654425d4532677321387cd8ae9499a593e5220fb7435de711048d661c527cee |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjVBOjFFRkM2OjFENDFDMjA6MjgwRUM3Mjo2OTZBQkQ0MCIsInZpc2l0b3JfaWQiOiI3ODUyNzg5NzY5MDcyOTgzMzYwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | dc56f4186656a12c9df6cc099d6a7c1fe7513d4a794ea3323c9ebcb77e3106b8 |
| hovercard-subject-tag | issue:2360509272 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/120713/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9c5d05332a120e6d2f672d21ef65d7930021f974a2850df668b07ad5e3db63b1/python/cpython/issues/120713 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9c5d05332a120e6d2f672d21ef65d7930021f974a2850df668b07ad5e3db63b1/python/cpython/issues/120713 |
| og:image:alt | Bug report Bug description: docs say: %Y Year with century as a decimal number. 0001, 0002, …, 2013, 2014, …, 9998, 9999 but this is what is happening from datetime import datetime print(datetime(9... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | martinvuyk |
| hostname | github.com |
| expected-hostname | github.com |
| None | 46ce962e0e18113ea447391b6ace8b02d4d2861e57b4fbab3658698f73d8855b |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 30300f30bb3949de255e84a146706a3bdb5c19c9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width