Created
May 21, 2012 21:34
-
-
Save nsfyn55/2764877 to your computer and use it in GitHub Desktop.
Timezone Hours Offset
This file contains hidden or 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 | |
from pytz import timezone | |
from datetime import datetime,timedelta | |
import time | |
utc = pytz.utc | |
utc.zone | |
eastern = timezone("America/New_York") | |
loc_dt = eastern.localize(datetime.now()) | |
offset = loc_dt.utcoffset() | |
if offset.days < 0: | |
seconds_off = loc_dt.utcoffset().seconds- (24*60*60) | |
else: | |
seconds_off = offset.seconds | |
print seconds_off/3600 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment