Sort and select orders by date