Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Time conversion between UTC and local time

Reply
Thread Tools

Time conversion between UTC and local time

 
 
andreas.profous@googlemail.com
Guest
Posts: n/a
 
      02-08-2008
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
 
Reply With Quote
 
 
 
 
Jeroen Ruigrok van der Werven
Guest
Posts: n/a
 
      02-08-2008
-On [20080208 15:16], http://www.velocityreviews.com/forums/(E-Mail Removed) ((E-Mail Removed)) 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)...
 
Reply With Quote
 
 
 
 
Miki
Guest
Posts: n/a
 
      02-09-2008
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 <(E-Mail Removed)>
http://pythonwise.blogspot.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert UTC DateTime to Local Time (Not My Local Time) Jonathan Wood ASP .Net 1 11-01-2009 12:08 AM
convert UTC to local time(system time) and vice vesra in VB.NET deepak ASP .Net 1 02-06-2008 02:34 PM
convert time string in UTC to time in local time davelist@mac.com Python 1 03-11-2007 12:57 AM
Difference between local time and UTC Generic Usenet Account C Programming 1 05-22-2006 08:17 PM
Covert UTC String to UTC Datetime =?Utf-8?B?aGVuaw==?= ASP .Net 3 05-07-2006 06:25 PM



Advertisments