Drop hours and minutes in datetime Python
<p>This is my first experience with Python. I am trying to determine how long it take for my code to run. Here is what I have:</p>

<pre><code>from datetime import datetime, timedelta
startTime = datetime.now()
#Some code
t = datetime.now() - startTime
print t.strftime("%S.%f")
</code></pre>

<p>But it gives me this error:</p>

<pre><code>'datetime.timedelta' object has no attribute 'strftime'
</code></pre>

<p>What should I do? I found this <a href="https://stackoverflow.com/questions/6677332/using-f-with-strftime-in-python-to-get-microseconds/6677382#6677382">example on StackOverflow</a> that is supposed to work and followed it:</p>

<pre><code>from datetime import datetime
now = datetime.now()
now.strftime("%H:%M:%S.%f")
&gt;&gt;'12:19:40.948000'
</code></pre>