Python time zone display -


i'm not sure if possible here's question:

in python, possible variable shows timezone relative utc time? example, est shown -5, pst -8.

thanks

not sure asking exactly. hope may help!,you can use datetime module . adapted http://docs.python.org/library/datetime.html#datetime.tzinfo.fromutc

from datetime import tzinfo, timedelta, datetime

class fixedoffset(tzinfo):     def __init__(self, offset):         self.__offset = timedelta(hours=offset)         self.__dst = timedelta(hours=offset-1)         self.__name = ''  def utcoffset(self, dt):     return self.__offset  def tzname(self, dt):     return self.__name  def dst(self, dt):     return self.__dst  print datetime.now() print datetime.now(fixedoffset(9)) 

gives:

 2011-03-12 00:28:32.214000  2011-03-12 14:28:32.215000+09:00 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -