temp<-as.Date(c("2014-06-01","1993-06-01", "2013-06-03", "1999-01-31"), "%Y-%m-%d") x<-format(temp, format="%m-%d") x [1] "06-01" "06-01" "06-03" "01-31" sort(x) [1] "01-31" "06-01" "06-01" "06-03"