Created
May 6, 2011 19:10
-
-
Save Jberlinsky/959574 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def format_time(time_str,timezone_str): | |
try: | |
tz = pytz.timezone(timezone_str) | |
except UnknownTimeZoneError: | |
tz = pytz.utc | |
dt = datetime.fromtimestamp(time_str) | |
localized_time = tz.localize(dt) | |
return localized_time.strftime("%l:%M ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.