from datetime import datetime
update_stan = '18-11-07 10:10:10'
type(update_stan )
# output: <type 'str'>
# 字符串转为日期时间格式
update_str = datetime.strptime(update_stan, '%y-%m-%d %H:%M:%S')
update_str
# output: datetime.datetime(2018, 11, 7, 10, 10, 10)
# 时间格式化为指定格式
update_date = update_str.strftime('%Y-%m-%d %H:%M:%S')
update_date
# output: '2018-11-07 10:10:10'
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。