Hi nabilabolo,
Check this example. Now please take its reference and correct your code.
Code
C#
DateTime[] array = new DateTime[5];
array[0] = Convert.ToDateTime("2020/09/25");
array[1] = Convert.ToDateTime("2020/09/26");
array[2] = Convert.ToDateTime("2020/09/27");
array[3] = Convert.ToDateTime("2020/09/28");
array[4] = Convert.ToDateTime("2020/10/02");
DateTime maxDate = array.Max(record => record.Date);
DateTime minDate = array.Min(record => record.Date);
VB.Net
Dim array As DateTime() = New DateTime(4) {}
array(0) = Convert.ToDateTime("2020/09/25")
array(1) = Convert.ToDateTime("2020/09/26")
array(2) = Convert.ToDateTime("2020/09/27")
array(3) = Convert.ToDateTime("2020/09/28")
array(4) = Convert.ToDateTime("2020/10/02")
Dim maxDate As DateTime = array.Max(Function(record) record.Date)
Dim minDate As DateTime = array.Min(Function(record) record.Date)
JavaScript
<script type="text/javascript">
window.onload = function () {
var dates = [];
dates.push(new Date("2020/09/25"));
dates.push(new Date("2020/09/26"));
dates.push(new Date("2020/09/27"));
dates.push(new Date("2020/09/28"));
dates.push(new Date("2020/10/02"));
var maxDate = new Date(Math.max.apply(null, dates)).toLocaleDateString();
var minDate = new Date(Math.min.apply(null, dates)).toLocaleDateString();
alert("Max Date : " + maxDate + "\nMin Date : " + minDate);
}
</script>