<p>I've got this date time string:</p>

<pre><code>post["date"] = "2007-07-18 10:03:19"
</code></pre>

<p>I'd like to extract just "2007-07-18" as a date. I've seen some reference to <code>strptime</code> but I'm not sure how to use it.  How can I extract the date from this string?</p>

In your case, just use split:
```
```
>>> d1="2007-07-18 10:03:19"
>>> d1.split()[0]
'2007-07-18'
>>>
```
```
(The 1st part after splitting with whitespace)
If you insist on using
```
strptime
```
, the format is
```
"%Y-%m-%d %H:%M:%S"
```
:
```
```
>>> import time
>>> time.strptime(d1,"%Y-%m-%d %H:%M:%S")
time.struct_time(tm_year=2007, tm_mon=7, tm_mday=18, tm_hour=10, tm_min=3, tm_sec=19, tm_wday=2, tm_yday=199, tm_isdst=-1)
>>> time.strftime("%Y-%m-%d", _)
'2007-07-18'
>>>
```
```