Linq query to find Smallest and largest date in an array of dates

i have an array of dates in which i want to find the start(smallest date) and end date (latest date), Kindly help

@Amrutha.mg

arrdates.Min and arrdates.Max

if string array then use function inside to get min and max

image

cheers

Hi @Amrutha.mg

startDate = dateArray.Select(Function(d) DateTime.Parse(d)).ToArray().Min()
endDate = dateArray.Select(Function(d) DateTime.Parse(d)).ToArray().Max()

Regards,

Thank you this helped me a lott :slight_smile:

1 Like

thank you this helped me :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.