I have datetime
a string "20160713161212"
.
It is a datetime
in string with format YYYYMMDDHHIISS
How to parse it to string with format "07/13/2016 16:12:12"
in Python?
Asked
Active
Viewed 55 times
1 Answers
2
I think that's what you are looking for:
from datetime import datetime
dt = datetime.strptime('20160713161212', '%Y%m%d%H%M%S')
new_dt = dt.strftime("%Y/%m/%d %H:%M:%S")
For further info you can take a look here

Yonatan Kiron
- 2,718
- 1
- 20
- 25