Different Dates

You have 10 different dates, it consists of past & future dates.
Bot should check how many old dates & how many new dates

Hi @Shravan_Pintu

oldDatesCount = dtDates.AsEnumerable().Count(Function(row) CDate(row("Date")) < DateTime.Now)

newDatesCount = dtDates.AsEnumerable().Count(Function(row) CDate(row("Date")) >= DateTime.Now)

Regards,

1 Like

How to give 10 different dates using excel?

@Shravan_Pintu

Input:

image

Output:

image

1 Like

dtDates.AsEnumerable().Count(Function(row) CDate(row(β€œDate” ))<DateTime.Now)

@Shravan_Pintu

Change OldDateCounts variable datatype to Int32

1 Like

in excel the format is DD/MM/YYYY?

@Shravan_Pintu

Try this

oldDatesCount = dtDates.AsEnumerable().Count(Function(row) DateTime.ParseExact(row("Date").ToString(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture) < DateTime.Now)

Thank you very much

got the solution

in excel using this formats helped MM/DD/YYYY

1 Like

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