Convert date string to UTC datetime
<p>I returned dates between two given dates:</p>

<pre><code>for date in rrule(DAILY, dtstart = date1, until = date2):
        print date_item.strftime("%Y-%m-%d")
</code></pre>

<p>How to convert the <code>date_item</code> e.g. <code>2016-01-01</code> to ISO 8601 format like:<code>2016-01-01T18:10:18.000Z</code> in python?</p>

<p>You can use <code>strftime</code> to convert <code>date_item</code> in any format as per your requirement.see the below example</p>

<pre><code>current_time = strftime("%Y-%m-%dT%H:%M:%SZ",gmtime())
print(current_time)
</code></pre>

<p>Output:  </p>

<pre><code>'2016-09-21T11:30:04Z'
</code></pre>

<p>so you can use like this:  </p>

<pre><code>from time import gmtime,strftime
import datetime
date_item = datetime.datetime.now()
print date_item.strftime("%Y-%m-%dT%H:%M:%SZ")
</code></pre>

python