Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
この方法で Python で datetime オブジェクトを作成できます。
import datetime new_date= datetime.datetime(2012,09,16)
datetimeこの形式の文字列から同じオブジェクトを作成するにはどうすればよい"16SEP2012"ですか?
datetime
"16SEP2012"
使用datetime.datetime.strptime:
datetime.datetime.strptime
>>> datetime.datetime.strptime('16Sep2012', '%d%b%Y') datetime.datetime(2012, 9, 16, 0, 0)