Compare commits
2 commits
2377e5e325
...
d4ecf243ae
Author | SHA1 | Date | |
---|---|---|---|
d4ecf243ae | |||
ecd4e3778e |
1 changed files with 0 additions and 20 deletions
20
timezone.py
20
timezone.py
|
@ -1,20 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from datetime import datetime, tzinfo, timedelta
|
||||
|
||||
|
||||
class TZMadrid(tzinfo):
|
||||
def utcoffset(self, dt):
|
||||
return timedelta(hours=1) + self.dst(dt)
|
||||
|
||||
def dst(self, dt):
|
||||
dston = datetime.date(dt.year, 4, 1)
|
||||
dstoff = datetime.date(dt.year, 10, 27)
|
||||
# Code to set dston and dstoff to the time zone's DST
|
||||
# transition times based on the input dt.year, and expressed
|
||||
# in standard local time.
|
||||
|
||||
if dston <= dt.replace(tzinfo=None) < dstoff:
|
||||
return timedelta(hours=1)
|
||||
else:
|
||||
return timedelta(0)
|
Loading…
Reference in a new issue