Convert a string to datetime object in python
<p>I have a date string defined as followed:</p>

<pre><code>datestr = '2011-05-01'
</code></pre>

<p>I want to convert this into a datetime object so i used the following code</p>

<pre><code>dateobj = datetime.datetime.strptime(datestr,'%Y-%m-%d')
print dateobj
</code></pre>

<p>But what gets printed is: 2011-05-01 00:00:00. I just need 2011-05-01. What needs to be changed in my code ?</p>

<p>Thank You</p>
