Skip to content

Datetime strftime: %Y exports years < 1000 with 3 digits instead of 4 on Linux #83717

Closed

Description

@JairoVadillo
BPO 39536
Nosy @mdickinson, @pmp-p
Superseder
  • bpo-13305: datetime.strftime("%Y") not consistent for years < 1000
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-02-03.11:36:14.670>
    created_at = <Date 2020-02-03.09:46:56.720>
    labels = ['3.7', 'type-bug', 'library']
    title = 'Datetime strftime: %Y exports years < 1000 with 3 digits instead of 4 on Linux'
    updated_at = <Date 2020-02-03.11:38:20.608>
    user = 'https://bugs.python.org/JairoVadillo'

    bugs.python.org fields:

    activity = <Date 2020-02-03.11:38:20.608>
    actor = 'mark.dickinson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-02-03.11:36:14.670>
    closer = 'mark.dickinson'
    components = ['Library (Lib)']
    creation = <Date 2020-02-03.09:46:56.720>
    creator = 'Jairo Vadillo'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39536
    keywords = []
    message_count = 3.0
    messages = ['361274', '361281', '361282']
    nosy_count = 3.0
    nosy_names = ['mark.dickinson', 'pmpp', 'Jairo Vadillo']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '13305'
    type = 'behavior'
    url = 'https://bugs.python.org/issue39536'
    versions = ['Python 3.7']

    Activity

    1. JairoVadillo commented on Feb 3, 2020

      JairoVadillomannequin
      MannequinAuthor

      This two examples are pretty simple.

      On MacOS stftime %Y works as expected, retrieving 4 digits:

      Python 3.7.6 (default, Dec 30 2019, 19:38:26)
      [Clang 11.0.0 (clang-1100.0.33.16)] on darwin

      datetime.strftime(datetime.now().replace(year=100), "%Y-%m-%d")
      '0100-02-03'

      But on Linux...:

      Python 3.7.6 (default, Jan 3 2020, 23:35:31)
      [GCC 8.3.0] on linux

      datetime.strftime(datetime.now().replace(year=100), "%Y-%m-%d")
      '100-02-03'

      This causes a lot of trouble when storing and then retrieving string dates from any string based storage.

    2. added
      3.7 (EOL)
      stdlib
      type-bug
      on Feb 3, 2020
    3. mdickinson commented on Feb 3, 2020

      @mdickinson
      Member

      Closing as a duplicate of bpo-13305. Feel free to add to the discussion there if you disagree with the resolution of that issue.

    4. mdickinson commented on Feb 3, 2020

      @mdickinson
      Member

      if you disagree with the resolution of that issue

      Sorry, my mistake. That issue is still open.

    5. transferred this issue fromon Apr 10, 2022
    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

      3.7 (EOL)stdlibtype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions