Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 497 Bytes

File metadata and controls

24 lines (17 loc) · 497 Bytes

python standard library datetime

python converting <class 'str'> to <class 'datetime'>

from datetime import datetime

s = '2018-10-28 11:00:00'
date_obj = datetime.strptime('s', '%Y-%m-%d %H:%M:%S')
# datetime(2018, 12, 28, 11, 0)

python datetime format symbol

symbol description
%Y
%m
%d
%H 小时
%M 分钟
%S