import time
Then add the below code
#Finding the daylight saving time
is_dst = time.daylight and time.localtime().tm_isdst > 0
utc_offset = (time.altzone if is_dst else time.timezone)
#Checking for negative and positve offset values
if(utc_offset > 0):
utc_offset_hours = (utc_offset / 3600)
sign = '- '
else:
utc_offset_hours = (-(utc_offset) / 3600)
sign = '+ '
utc_offset_minutes = (utc_offset % 3600) / 60
#Converting Integer values to string before concatenating
utc_offset = sign + str(utc_offset_hours) + '.' +str(utc_offset_minutes)
print utc_offset
Then add the below code
#Finding the daylight saving time
is_dst = time.daylight and time.localtime().tm_isdst > 0
utc_offset = (time.altzone if is_dst else time.timezone)
#Checking for negative and positve offset values
if(utc_offset > 0):
utc_offset_hours = (utc_offset / 3600)
sign = '- '
else:
utc_offset_hours = (-(utc_offset) / 3600)
sign = '+ '
utc_offset_minutes = (utc_offset % 3600) / 60
#Converting Integer values to string before concatenating
utc_offset = sign + str(utc_offset_hours) + '.' +str(utc_offset_minutes)
print utc_offset
Older Posts
< ||| > > > Newer Posts