python - Converting string into datetime -


short , simple. i've got huge list of date-times strings:

jun 1 2005  1:33pm aug 28 1999 12:00am 

i'm going shoving these proper datetime fields in database need magic them real datetime objects.

any (even if it's kick in right direction) appreciated.

edit: going through django's orm can't use sql conversion on insert.

from datetime import datetime  datetime_object = datetime.strptime('jun 1 2005  1:33pm', '%b %d %y %i:%m%p') 

the resulting datetime object timezone-naive.

links:

notes:

  • strptime = "string parse time"
  • strftime = "string format time"
  • pronounce out loud today & won't have search again in 6 months.

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -