Skip to content

support %z format in time.strftime and _strptime? #48336

Closed

Description

@smontanaro
BPO 4086
Nosy @abalkin
Superseder
  • bpo-6641: datetime.strptime doesn't support %z format ?
  • 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 = 'https://github.com/abalkin'
    closed_at = <Date 2010-10-15.17:54:36.396>
    created_at = <Date 2008-10-09.11:27:25.421>
    labels = ['type-feature']
    title = 'support %z format in time.strftime and _strptime?'
    updated_at = <Date 2010-10-15.17:54:36.395>
    user = 'https://github.com/smontanaro'

    bugs.python.org fields:

    activity = <Date 2010-10-15.17:54:36.395>
    actor = 'georg.brandl'
    assignee = 'belopolsky'
    closed = True
    closed_date = <Date 2010-10-15.17:54:36.396>
    closer = 'georg.brandl'
    components = []
    creation = <Date 2008-10-09.11:27:25.421>
    creator = 'skip.montanaro'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 4086
    keywords = []
    message_count = 2.0
    messages = ['74570', '118701']
    nosy_count = 1.0
    nosy_names = ['belopolsky']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = None
    status = 'closed'
    superseder = '6641'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue4086'
    versions = ['Python 3.2']

    Activity

    1. smontanaro commented on Oct 9, 2008

      @smontanaro
      ContributorAuthor

      While responding to a c.l.py question just now I discovered that
      numeric timezone offsets don't appear to be supported by either the
      time.strftime function or the _strptime module. I noticed on my
      Mac's strftime(3) man page that it supports a %Z format for TZ
      names and a %z format for numeric tz offsets. It seems Python
      should as well.

    2. self-assigned this
      on Jun 12, 2010
    3. abalkin commented on Oct 14, 2010

      @abalkin
      Member

      Closing as a duplicate of (closed) bpo-6641.

      time.strftime appears to support %z on the platforms that support it in C strftime:

      >>> time.strftime("%z", time.localtime())
      '-0400'
    4. 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

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions