Reputation: 3793
I have a unicode string for example u'Mar232012'. I want to convert it to the format MM/DD/YYYY using python in the post efficient and reliable manner.
Upvotes: 4
Views: 8358
Reputation: 213025
import datetime
datetime.datetime.strptime(u'Mar232012', '%b%d%Y').strftime('%m/%d/%Y')
prints '03/23/2012'
Upvotes: 11