GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Documentation: Error in datetime.datetime.strptime() · Issue #94300 · python/cpython

Documentation: Error in datetime.datetime.strptime() #94300

New issue
Copy link
New issue
Copy link
Closed
Closed
Documentation: Error in datetime.datetime.strptime()#94300
Copy link
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dir

Description

@jonschz
jonschz
opened on Jun 26, 2022
Issue body actions

Documentation

The documentation for datetime.datetime.strptime is incorrect:

cpython/Doc/library/datetime.rst

Lines 1048 to 1050 in bb8b931

This is equivalent to::
datetime(*(time.strptime(date_string, format)[0:6]))

This is incorrect if format contains microseconds or timezone information. Counterexample:

>>> timestr = '20200304050607.554321'
>>> print(datetime.strptime(timestr, '%Y%m%d%H%M%S.%f'))
2020-03-04 05:06:07.554321
>>> print(datetime(*(time.strptime(timestr, '%Y%m%d%H%M%S.%f')[0:6])))
2020-03-04 05:06:07

I suggest removing the cited part entirely, since since I see no easy way of correcting these lines, especially concerning timezones.

Linked PRs

  • gh-94300: Update datetime library documentation #95318
  • [3.11] gh-94300: Update datetime.strptime documentation (GH-95318) #103785
Reacted by Tom Aarsen and Rasoul

Activity

  1. jonschz
    added
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    on Jun 26, 2022
  2. pganssle
    added a commit that references this issue on Apr 24, 2023

    gh-94300: Update datetime.strptime documentation (#95318)

    5b404d6
  3. miss-islington
    added a commit that references this issue on Apr 24, 2023

    pythongh-94300: Update datetime.strptime documentation (pythonGH-95318)

    2481ebc
  4. carljm
    added 2 commits that reference this issue on Apr 24, 2023

    Merge branch 'main' into superopt

    19b8025

    Merge branch 'superopt' into superopt_spec

    1972ca4
  5. hauntsaninja
    closed this as completedon Apr 26, 2023
  6. hauntsaninja
    added a commit that references this issue on Apr 26, 2023

    [3.11] gh-94300: Update datetime.strptime documentation (GH-95318) (#…

    410c2ce
  7. hauntsaninja commented on Apr 26, 2023

    @hauntsaninja
    hauntsaninja
    on Apr 26, 2023
    Contributor
    More actions

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirDocumentation in the Doc dir

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.