Time conversion between UTC and local time

Discussion in 'Python' started by andreas.profous@googlemail.com, Feb 8, 2008.

  1. Guest

    Hi all,

    I have the following problem:
    There are strings describing a UTC time, e.g. " 2008-01-15 22:32:30"
    and a string reflecting the time
    zone e.g. "-05:00".

    What is an elegant way of getting the local time (considering DST -
    daylight saving time) with that data?
    The date is not important, just the local time.
    The format is not important, the easiest would probably be a tuple
    (h,m,s) .

    Thanks in advance
     
    , Feb 8, 2008
    #1
    1. Advertising

  2. -On [20080208 15:16], () wrote:
    >What is an elegant way of getting the local time (considering DST -
    >daylight saving time) with that data?


    Perhaps using pytz might be the easiest way: http://pytz.sourceforge.net/

    --
    Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
    イェルーン ラウフロック ヴァン デル ウェルヴェン
    http://www.in-nomine.org/ | http://www.rangaku.org/
    But Time, keeps flowing like a river (on and on)...
     
    Jeroen Ruigrok van der Werven, Feb 8, 2008
    #2
    1. Advertising

  3. Miki Guest

    Hello,

    > I have the following problem:
    > There are strings describing a UTC time, e.g. " 2008-01-15 22:32:30"
    > and a string reflecting the time
    > zone e.g. "-05:00".
    >
    > What is an elegant way of getting the local time (considering DST -
    > daylight saving time) with that data?
    > The date is not important, just the local time.
    > The format is not important, the easiest would probably be a tuple
    > (h,m,s) .


    http://labix.org/python-dateutil

    HTH,
    --
    Miki <>
    http://pythonwise.blogspot.com
     
    Miki, Feb 9, 2008
    #3
    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. =?Utf-8?B?aGVuaw==?=

    Covert UTC String to UTC Datetime

    =?Utf-8?B?aGVuaw==?=, May 7, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    18,764
    Egbert Nierop \(MVP for IIS\)
    May 7, 2006
  2. Generic Usenet Account

    Difference between local time and UTC

    Generic Usenet Account, May 22, 2006, in forum: C Programming
    Replies:
    1
    Views:
    564
    Eric Sosman
    May 22, 2006
  3. Replies:
    1
    Views:
    814
    Paul Boddie
    Mar 11, 2007
  4. deepak
    Replies:
    1
    Views:
    30,666
    Kevin Spencer
    Feb 6, 2008
  5. Jonathan Wood
    Replies:
    1
    Views:
    2,213
    Jonathan Wood
    Nov 1, 2009
Loading...

Share This Page