Skip to content

time.asctime_tz, time.strftime %z %C #43269

Closed

Description

@kxroberto
mannequin
BPO 1475397
Nosy @abalkin, @devdanzin
Superseder
  • bpo-9527: Add aware local time support to datetime module
  • 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 2011-04-07.19:56:22.659>
    created_at = <Date 2006-04-24.09:40:31.000>
    labels = ['type-feature', 'library']
    title = 'time.asctime_tz, time.strftime %z %C'
    updated_at = <Date 2011-04-07.19:56:22.658>
    user = 'https://bugs.python.org/kxroberto'

    bugs.python.org fields:

    activity = <Date 2011-04-07.19:56:22.658>
    actor = 'belopolsky'
    assignee = 'belopolsky'
    closed = True
    closed_date = <Date 2011-04-07.19:56:22.659>
    closer = 'belopolsky'
    components = ['Library (Lib)']
    creation = <Date 2006-04-24.09:40:31.000>
    creator = 'kxroberto'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 1475397
    keywords = []
    message_count = 4.0
    messages = ['61229', '83911', '83928', '116304']
    nosy_count = 3.0
    nosy_names = ['belopolsky', 'kxroberto', 'ajaksu2']
    pr_nums = []
    priority = 'normal'
    resolution = 'rejected'
    stage = 'resolved'
    status = 'closed'
    superseder = '9527'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1475397'
    versions = ['Python 3.2']

    Activity

    1. kxroberto commented on Apr 24, 2006

      kxrobertomannequin
      MannequinAuthor

      Very often I need (for logging purposes, legal
      international action confirmation display, ...) quickly
      a stable/constant/technical/international timezone info
      in addition to %c / .asctime. And find me regularly
      checking if the computer/server displays %Z nice,
      writing 10-liner funcs ...

      found %z by trial (and in footnote)

      yet time.strftime('%c %z') flickers (on Windows..)

      think, %z can be computed very easily independent of OS
      libs? time.altzone /% 3600 ... ==> "+/-HHMM" ?

      that could be doc'ed.

      ( the sign of time.timezone / time.altzone is
      unfortunately revers of RFC standardds , yet its ok
      doced. there should be a function/update-function for
      long running apps also ? )

      then .asctime_tz() would be very nice to find it in the
      docs. (and maybe asctime_TZ)

      -robert

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Apr 24, 2006
    3. devdanzin commented on Mar 21, 2009

      devdanzinmannequin
      Mannequin

      Could you provide a test case and clearer description of your feature
      request?

    4. kxroberto commented on Mar 21, 2009

      kxrobertomannequin
      MannequinAuthor

      (I'm somewhat away from all that currently - and not aware if newest
      Python versions already solved but:)

      • a "time.asctime_tz([tim])" or so should deliver a full OS-indep.
        _world_ time string incl. numeric timezone info like
        "Sat Mar 21 10:33:36 2009 +0000"
        It should accept a 10-tuple (like urlopen_file.info().getdate_tz('date'),
        or a time.time() float time,
        or interpret a 9-tuple as GMTIME/UTC.

      • strftime("%z") should be supported on all OS - _constant numeric_
        format "+0000"

      • strftime("%C",[tim]) should be like asctime_tz.
        it should accept as 2nd parameter a 10-tuple alternatively,
        or a time.time() universal float time,
        or interpret the 9-tuple as LOCALTIME as it were.

      test cases to add:

      • simple render a variation of constant tuples/float_times to constant
        result strings.
    5. changed the title [-]compute/doc %z os-indep., time.asctime_tz / _TZ[/-] [+]time.asctime_tz, time.strftime %z %C[/+] on Mar 21, 2009
    6. changed the title [-]compute/doc %z os-indep., time.asctime_tz / _TZ[/-] [+]time.asctime_tz, time.strftime %z %C[/+] on Mar 21, 2009
    7. abalkin commented on Sep 13, 2010

      @abalkin
      Member

      Would bpo-9527 address your request? Note that datetime.strftime already supports %z:

      >>> from datetime import *
      >>> datetime.now(timezone.utc).strftime('%c %z')
      'Mon Sep 13 13:43:19 2010 +0000'

      (I assume you meant to write %c, not %C.)

    8. 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

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions