How to change date format and add a day to the date
<p>I have a date format that looks like this: 2016-08-30 and need to transform it to yyyy,mm,dd, as well as add a day. The purpose is to get a quandl format for days.</p>

<pre><code>i = datetime.strptime(i,'%Y-%m-%d').strftime('%Y,%-m,%d')
print i
j = dt.datetime(i) + dt.timedelta(1)
</code></pre>

<p>This is the code I have.
It tells me that I need to have an int in the dt.datetime function, but when I make it an int by doing dt.datetime(int(i)), I get this error.</p>

<pre><code>ValueError: invalid literal for int() with base 10: '2016,8,30'
</code></pre>

<p>Thanks</p>

<p>You can use <code>timedelta</code> to add a day and use <code>strftime</code> to format the date string.</p>

<pre><code>import datetime

dt = datetime.datetime.strptime('2016-01-23', '%Y-%m-%d')
dt = dt + datetime.timedelta(days=1)
print dt.strftime('%Y,%m,%d')
</code></pre>

python datetime date-formatting timedelta