@marina.dutta,
Ok in that case, use array. Add these datetime strings in an array and then sort the array.
Follow this thread for solution.