import datetime
dates = [datetime.datetime.strptime(ts, '%Y-%m-%d') for ts in timestamps]
dates.sort()
sorteddates = [datetime.datetime.strftime(ts, '%Y-%m-%d') for ts in dates]
sort dates in python array