time.strftime Timezone issue

Discussion in 'Python' started by Allen Unueco, Jun 13, 2004.

  1. Allen Unueco

    Allen Unueco Guest

    I feel that the '%Z' format specifier from strftime() returns the wrong
    value when daylight savings is in effect.

    Today the following is always true:
    time.strftime('%Z') == time.tzname[0]

    Shouldn't it be:
    time.strftime('%Z') == time.tzname[time.daylight]

    -allen
     
    Allen Unueco, Jun 13, 2004
    #1
    1. Advertising

  2. Allen Unueco

    Allen Unueco Guest

    Never mind,

    I just looked at Modules/timemodule.c and now I realize it that
    time.strftime() is just a wrapper for the c library function of the same
    name.

    I guess I'll just live with my 'time.tzname[time.daylight]' code.

    -allen


    Allen Unueco wrote:
    > I feel that the '%Z' format specifier from strftime() returns the wrong
    > value when daylight savings is in effect.
    >
    > Today the following is always true:
    > time.strftime('%Z') == time.tzname[0]
    >
    > Shouldn't it be:
    > time.strftime('%Z') == time.tzname[time.daylight]
    >
    > -allen
     
    Allen Unueco, Jun 13, 2004
    #2
    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. Tim Peters

    RE: time.strftime Timezone issue

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

    RE: time.strftime Timezone issue

    Tim Peters, Jun 13, 2004, in forum: Python
    Replies:
    0
    Views:
    686
    Tim Peters
    Jun 13, 2004
  3. asaf
    Replies:
    3
    Views:
    6,234
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    Sep 11, 2006
  4. axrock
    Replies:
    8
    Views:
    1,004
    Roedy Green
    Mar 25, 2009
  5. David Joseph Bonnici
    Replies:
    1
    Views:
    231
    Gunnar Hjalmarsson
    May 15, 2005
Loading...

Share This Page