I have below expression with me : -
ReadDT.AsEnumerable().Any(Function(x) Convert.ToDateTime(x(“Date”)).ToString = “16/09/19”)
I need to know what is the format of X in this expression ?
#learning
I have below expression with me : -
ReadDT.AsEnumerable().Any(Function(x) Convert.ToDateTime(x(“Date”)).ToString = “16/09/19”)
I need to know what is the format of X in this expression ?
#learning
In that case, it should return me true , if it is row… Because in my excel sheet 16/09/19 date is exist , but still this is returning false to me…
Can anyone help me in that ?
@sachinl When read the date from excel format of date as not same as what see in excel in most of the cases. In most of the cases time is also included but you unable to see it in your excel.
If you want to know the date format in your excel display using message box or write line.
@Manjuts90 → I have done this and also I am getting the exact case what you mentioning here, I am getting 00:00:00 with the date. And I am trying to mitigate the time but somehow I am not able to do it…
I use following expression :-
ReadDT.AsEnumerable().Any(Function(x) Convert.ToDateTime(x(“Date”).ToString).ToString = “17/09/19”)
but this still shows me False.
Is there any mistake in above expression ??
Try like below and check
ReadDT.AsEnumerable().Any(Function(x) Convert.ToDateTime(x(“Date”).ToString).ToString(“dd/MM/yyyy”) = “17/09/19”)
@sachinl Please check the date format your are getting from excel and how many date formats are present in excel.
@sachinl Please check the format of date after reading from excel. can you upload sample excel if it is fine?
Hello @sachinl
You are using this code and matching for this date 16/09/19 but in your sheet that date is not present
Try this code
DT.AsEnumerable().Where(Function(n) cdate(n("Date")).ToString("dd/MM/yy") = ("23/09/19") ).CopyToDataTable