Last active
August 29, 2015 14:01
-
-
Save shervinafshar/641ac6a5df2f2f5749c0 to your computer and use it in GitHub Desktop.
Using `pytz` for conversation of time and date into other timezones.
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
import pytz, datetime, calendar | |
#import dateutil | |
d1 = datetime.datetime(2013, 4, 20, 7, 50, tzinfo=pytz.timezone('US/Pacific')) | |
d2 = datetime.datetime(2013, 4, 20, 9, 40, tzinfo=pytz.timezone('US/Pacific')) | |
d1Utc = d1.astimezone(pytz.timezone('UTC')) | |
d1UtcTs = calendar.timegm(d1.utctimetuple()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment