Question: how to change the date format in python?
Answer: oldformat = '20140716' datetimeobject = datetime. strptime(oldformat,'%Y%m%d')
newformat = datetimeobject. strftime('%m-%d-%Y') print newformat. 07-16-2014.
newformat2 = datetimeobject. strftime('%m/%d/%Y') print newformat2. 07/16/2014.