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
Post a Comment