Posted at

PythonでISO8601形式の時刻を好きな書式に整形する

More than 1 year has passed since last update.

import dateutil.parser

s = '2017-02-16 01:27:00+00:00'
t = dateutil.parser.parse(s)

# 整形
u = t.strftime('%Y/%m/%d')
print(u) #=> 2017/02/16