Last active
October 30, 2020 17:46
-
-
Save simonswine/eecba71bd10a2852bb49de3e4c27e12c to your computer and use it in GitHub Desktop.
Calculate the time range in cortex's weekly tables
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
from datetime import datetime,timedelta | |
from pytz import timezone | |
tz = timezone('America/Los_Angeles') | |
period = 7*24*3600 | |
for index in range (2648, 2654): | |
index_from = datetime.fromtimestamp(index*period,tz=tz) | |
index_to = datetime.fromtimestamp((index+1)*period-1,tz=tz) | |
print ('index %d: from %s to %s' % (index, index_from.isoformat(), index_to.isoformat())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment