I have few date as input
12/31/2021
1/6/2021
2/7/2021
2/28/2023
Amoung this date 2/28/2023 is the highest one(latest date).How to identify that
I have few date as input
12/31/2021
1/6/2021
2/7/2021
2/28/2023
Amoung this date 2/28/2023 is the highest one(latest date).How to identify that
These dates data is in the datatable or List or string…?
if date items are in list it will helpful to you
Assign latestDate = (From dateStr In dateList
Let dateValue = DateTime.ParseExact(dateStr, "M/d/yyyy",
System.Globalization.CultureInfo.InvariantCulture)
Order By dateValue Descending
Select dateValue).FirstOrDefault()
Hi @sruthesanju
datetime variable = listDate.AsEnumerable.Max(function(x) cdate(x))
Hi @sruthesanju
→ Read Range Workbook (Enable Preserve Format in properties)
maxDate = (From row In dateTable.AsEnumerable()
Select DateTime.ParseExact(row("DateColumn").ToString(), "M/d/yyyy", CultureInfo.InvariantCulture)).Max()
maxDate
is of System.DateTime
Regards
Hi @sruthesanju
Could you confirm with that, How you are getting these values from excel or these are store in a list or in String format.
Hey @sruthesanju
check this:
listOfDates = New List(Of DateTime) From {
DateTime.Parse("12/31/2021"),
DateTime.Parse("1/6/2021"),
DateTime.Parse("2/7/2021"),
DateTime.Parse("2/28/2023")
}
' Finding the latest date
latestDate = listOfDates.Max()