Tag Archives: Dates

Sort an array of string of dates in ascending order

Given an array arr[] of N dates in the form of “dd-mm-yyyy”, the task is to sort these dates in ascending order. Examples: Input: arr[] = { “25-08-1996”, “03-08-1970”, “09-04-1994” } Output: 03-08-1970 09-04-1994 25-08-1996 Input: arr[] = { “14-02-1972”, “01-01-2001”} Output: 14-02-1972 01-01-2001 A simple solution that comes to our mind is to delete all ‘-‘ from… Read More »