sort chronologically the data