Skip to content

Instantly share code, notes, and snippets.

@ryantuck
Created January 27, 2016 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryantuck/fd8a6c8f47d469b54a7f to your computer and use it in GitHub Desktop.
Save ryantuck/fd8a6c8f47d469b54a7f to your computer and use it in GitHub Desktop.
import arrow
import pprint
start = '2015-01-01'
end = '2015-01-02'
s = arrow.get(start)
e = arrow.get(end)
print s
print e
num_days = (e-s).days
def chunks(l,n):
for i in xrange(0, len(l), n):
yield l[i:i+n]
date_chunks = list(chunks(range(0,num_days), 10))
d = 0
diff = 10
while d < num_days:
tmp_start = d
tmp_end = min((d+diff), num_days)
print tmp_start, '/', tmp_end
print s.replace(days=+tmp_start).format('YYYY-MM-DD')
print s.replace(days=+tmp_end).format('YYYY-MM-DD')
d += diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment