>time.strftime %T missing in 2.3

Discussion in 'Python' started by Andy Leszczynski, Aug 5, 2005.

  1. Python 2.2/Unix

    >>time.strftime("%T")

    '22:12:15'
    >>time.strftime("%X")

    '22:12:17'

    Python 2.3/Windows

    >>time.strftime("%X")

    '22:12:47'
    >> time.strftime("%T")

    ''

    Any clues?

    A.
    Andy Leszczynski, Aug 5, 2005
    #1
    1. Advertising

  2. Andy Leszczynski

    Robert Kern Guest

    Andy Leszczynski wrote:
    > Python 2.2/Unix
    >
    > >>time.strftime("%T")

    > '22:12:15'
    > >>time.strftime("%X")

    > '22:12:17'
    >
    > Python 2.3/Windows
    >
    > >>time.strftime("%X")

    > '22:12:47'
    > >> time.strftime("%T")

    > ''


    From http://docs.python.org/lib/node252.html

    """The full set of format codes supported varies across platforms,
    because Python calls the platform C library's strftime() function, and
    platform variations are common."""

    So I suggest that it's a platform issue, not a Python version issue. FWIW:

    Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
    [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import time
    >>> time.strftime("%T")

    '22:50:49'
    >>> time.strftime("%X")

    '22:50:59'

    --
    Robert Kern


    "In the fields of hell where the grass grows high
    Are the graves of dreams allowed to die."
    -- Richard Harter
    Robert Kern, Aug 5, 2005
    #2
    1. Advertising

  3. Robert Kern wrote:
    > Andy Leszczynski wrote:
    >
    >> Python 2.2/Unix
    >>
    >> >>time.strftime("%T")

    >> '22:12:15'
    >> >>time.strftime("%X")

    >> '22:12:17'
    >>
    >> Python 2.3/Windows
    >>
    >> >>time.strftime("%X")

    >> '22:12:47'
    >> >> time.strftime("%T")

    >> ''

    >
    >
    > From http://docs.python.org/lib/node252.html
    >
    > """The full set of format codes supported varies across platforms,
    > because Python calls the platform C library's strftime() function, and
    > platform variations are common."""
    >
    > So I suggest that it's a platform issue, not a Python version issue. FWIW:
    >
    > Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
    > [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
    > Type "help", "copyright", "credits" or "license" for more information.
    > >>> import time
    > >>> time.strftime("%T")

    > '22:50:49'
    > >>> time.strftime("%X")

    > '22:50:59'
    >


    I accept that, but still pain. Took me a while to filter out the problem
    in the code running on the Unix and not on M$.

    A.
    Andy Leszczynski, Aug 5, 2005
    #3
  4. Andy Leszczynski wrote:

    > I accept that, but still pain. Took me a while to filter out the problem
    > in the code running on the Unix and not on M$.


    This is one of the reasons I usually use Cygwin Python when I can. Stuff
    is much less likely to mysteriously break when moving from UNIX to
    Cygwin then from UNIX to Windows.
    --
    Michael Hoffman
    Michael Hoffman, Aug 5, 2005
    #4
  5. Andy Leszczynski

    Jorgen Grahn Guest

    On Fri, 05 Aug 2005 01:02:48 -0500, Andy Leszczynski <leszczynscyATnospam.yahoo.com.nospam> wrote:
    > Robert Kern wrote:
    >> Andy Leszczynski wrote:
    >>
    >>> Python 2.2/Unix
    >>>
    >>> >>time.strftime("%T")
    >>> '22:12:15'
    >>> >>time.strftime("%X")
    >>> '22:12:17'
    >>>
    >>> Python 2.3/Windows
    >>>
    >>> >>time.strftime("%X")
    >>> '22:12:47'
    >>> >> time.strftime("%T")
    >>> ''

    >>
    >>
    >> From http://docs.python.org/lib/node252.html
    >>
    >> """The full set of format codes supported varies across platforms,
    >> because Python calls the platform C library's strftime() function, and
    >> platform variations are common."""
    >>
    >> So I suggest that it's a platform issue, not a Python version issue. FWIW:
    >>
    >> Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
    >> [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
    >> Type "help", "copyright", "credits" or "license" for more information.
    >> >>> import time
    >> >>> time.strftime("%T")

    >> '22:50:49'
    >> >>> time.strftime("%X")

    >> '22:50:59'
    >>

    >
    > I accept that, but still pain. Took me a while to filter out the problem
    > in the code running on the Unix and not on M$.


    I can imagine ...

    By the way, you should probably /not/ change %T to %X.

    %T (standardized in the Singe Unix Specification) is the same thing as ANSI
    C %H:%M:%S which should be usable everywhere. %X on the other hand is "The
    preferred time representation for the current locale without the date".
    Not the same thing at all, for some users.

    /Jorgen

    --
    // Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu
    \X/ algonet.se> R'lyeh wgah'nagl fhtagn!
    Jorgen Grahn, Aug 21, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Allen Unueco

    time.strftime Timezone issue

    Allen Unueco, Jun 13, 2004, in forum: Python
    Replies:
    1
    Views:
    352
    Allen Unueco
    Jun 13, 2004
  2. Tim Peters

    RE: time.strftime Timezone issue

    Tim Peters, Jun 13, 2004, in forum: Python
    Replies:
    1
    Views:
    746
    Allen Unueco
    Jun 13, 2004
  3. Tim Peters

    RE: time.strftime Timezone issue

    Tim Peters, Jun 13, 2004, in forum: Python
    Replies:
    0
    Views:
    665
    Tim Peters
    Jun 13, 2004
  4. Sheila King
    Replies:
    5
    Views:
    945
    Moderator, k12.ed.math
    Apr 22, 2005
  5. Greg Krohn
    Replies:
    1
    Views:
    934
    Denis Kasak
    Feb 17, 2009
Loading...

Share This Page