title: Get yesterday's date in Python, DST-safe
body: <p>I have a python script that uses this call to get yesterday's date in YYYY-MM-DD format:</p>
  
  <pre><code>str(date.today() - timedelta(days=1)))
  </code></pre>
  
  <p>It works most of the time, but when the script ran this morning at <code>2013-03-11 0:35 CDT</code> it returned <code>"2013-03-09"</code> instead of <code>"2013-03-10"</code>.</p>
  
  <p>Presumably daylight saving time (which started yesterday) is to blame. I guess the way <code>timedelta(days=1)</code> is implemented it subtracted 24 hours, and 24 hours before <code>2013-03-11 0:35 CDT</code> was <code>2013-03-09 23:35 CST</code>, which led to the result of <code>"2013-03-09"</code>.</p>
  
  <p>So what's a good DST-safe way to get yesterday's date in python? </p>
  
  <p><strong>UPDATE:</strong>
  After bukzor pointed out that my code should have worked properly, I went back to the script and determined it wasn't being used. It sets the default value, but a wrapper shell script was setting the date explicitly. So the bug is in the shell script, not the python script.</p>