Permalink
Browse files

Fix for delta_day passing the month barrier using datetime arithmetic.

  • Loading branch information...
pydevlogin committed Jan 9, 2014
1 parent 1d3f5d5 commit 27855864319e8df6ea768b8d1528c33feae56eb4
Showing with 3 additions and 11 deletions.
  1. +3 −11 pdf_request.py
View
@@ -79,17 +79,9 @@ def main():
# get today's date (for pdf file name)
today = datetime.datetime.utcnow()
year = today.strftime('%Y')
month = today.strftime('%m')
day = today.strftime('%d')
print 'day=', day
day_with_delta = int(day) + delta_day
print 'day with delta=', day_with_delta
today_string = year + '_' + month + '_%02i'% day_with_delta
filename = today_string + '.pdf'
target_date = today + datetime.timedelta(days=delta_day)
filename = target_date.strftime("%Y_%m_%d.pdf")
## check if the file I am about to download might already exist on dropbox
drb_path = '/Apps/Pythonista/'
exists = client.search(drb_path, filename)

0 comments on commit 2785586

Please sign in to comment.