title: Extracting a date from a Python object
body: <p>I have a variable which is a Python object and contains information relating to the date and time that the information was recorded. It is in the following format</p>
  
  <pre><code>Date_time_Created
  2012-06-29 11:23:44.882
  2012-07-27 14:53:46.909
  2014-05-01 16:12:32.005
  2014-10-27 18:25:57.403
  2014-10-29 10:58:46.013
  2014-11-06 22:24:24.872
  2014-11-06 22:26:13.218
  2015-02-17 04:48:35.229
  2015-04-14 07:54:43.969
  2015-04-14 07:58:42.896
  2015-04-14 08:00:35.552
  2015-04-14 08:10:11.627
  2015-04-14 08:14:37.842
  2015-04-14 08:18:47.501
  2015-04-14 08:27:21.895
  2015-04-14 08:30:21.376
  2015-04-14 08:33:42.146
  2015-04-14 08:38:06.271
  2015-04-14 08:44:36.056
  2015-04-14 08:49:40.434
  2015-04-14 08:56:38.785
  2015-04-14 08:59:12.542
  2015-04-14 09:01:19.538
  </code></pre>
  
  <p>I would like to be able to extract from this just the date (although knowing how to do the time would also be useful!).</p>
  
  <p>I have tried the following that 'should' work with a string</p>
  
  <pre><code>match = re.search(r'\d{4}-\d{2}-\d{2}', text)
  date = datetime.strptime(match.group(), '%Y-%m-%d').date()
  </code></pre>
  
  <p>however the datatype of the data I am working with is a Python object.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks in advance!</p>