將字符串轉換爲日期時間 - Converting string into datetime

問題:

I've got a huge list of date-times like this as strings: 我有大量的日期時間列表,例如字符串: 數據庫

Jun 1 2005  1:33PM
Aug 28 1999 12:00AM

I'm going to be shoving these back into proper datetime fields in a database so I need to magic them into real datetime objects. 我將把它們推回到數據庫中正確的日期時間字段中,所以我須要將它們魔術化爲實際的日期時間對象。 this

This is going through Django's ORM so I can't use SQL to do the conversion on insert. 這是經過Django的ORM進行的,所以我沒法使用SQL進行插入時的轉換。 spa


解決方案:

參考一: https://stackoom.com/question/1xJh/將字符串轉換爲日期時間
參考二: https://oldbug.net/q/1xJh/Converting-string-into-datetime
相關文章
相關標籤/搜索