Let\'s say I have a string: \"10/12/13\" and \"10/15/13\", how can I convert them into date objects so that I can compare the dates? For example to see which date is before
import datetime d1="10/12/13" d2="10/15/13" date = d1.split('/') d1=datetime.datetime(int(date[2]),int(date[1]),int(date[0])) date = d2.split('/') d2=datetime.datetime(int(date[2]),int(date[1]),int(date[0])) if d1 > d2 : ## Code today = datetime.datetime.today() if d1 > today : ## code