Dataview row filter on date filed

  • Thread starter Thread starter vicky
  • Start date Start date
V

vicky

i am filtering a dataview using rofilter, the field i am
filtering is datetime type but i only want to filter on
date part of the field ignoring time part. How is it
possible

Thanks
 
Hi Vicky,

I think that the only thing I can help you with is something like this.
\\\
Dim dr2() As DataRow
For Each dr As DataRow In dt.Rows
Dim a As Integer
If CDate(dr("Dates")).Month = 5 Then
a += 1
ReDim dr2(a)
dr2(a - 1) = dr
End If
Next
MessageBox.Show(dr2(0)("Dates").ToString)
////

Cor
 
I am not with vs.net right now. But, you can try to use <dt> >= <dt1> and
<dt> <= <dt2> for instance.

Regards,

Rajesh Patel
 
Hi Bill,

Funny, I was reading a part of the date, instead of the date part.

Thinking, thinking and no solution, however this is easy, because the date
is always the date.

:-))

Cor
 
William Ryan eMVP said:
Hi Vicky:

The whole battle is in getting the Value you are comparing against in the
correct format. You can use DateTime myDate =
(DateTime)dataVarName.ToShortDateString(); ///or you can use .Parse or any
other mechanism you want.

Just don't forget to use CultureInfo.InvariantCulture when converting date
to string :-)
 
Hi Miha,
Just don't forget to use CultureInfo.InvariantCulture when converting date
to string :-)

That is only for people who program for world around.
I thought that in Europe we all are using dd-mm-yy or variants from that and
in the US mm-dd-yy however I am very curious what it is in the Balkan
countries including Turkey because I am not sure of that, do you know that?

Cor
 
Back
Top