First please install datautil related package by pip.
pip install python-dateutil
Chaged format from XX/XX/XXX to XXXXXX using strftimfrom datetime import datetime
d = "2018/01/02"
print(datetime.strftime(datetime.strptime(d, '%Y/%m/%d'), '%Y%m%d'))
Output: 20180102
from datetime import datetime
d = "2018/01/02"
print(datetime.strftime(datetime.strptime(d, '%Y/%m/%d'), '%Y%m%d
Output: Mon Feb 15 10
No comments:
Post a Comment