Reputation: 6694
I need to have a query which list all the user according to the date value in the database. Problems is this, in the database the date format is 5/5/2009 4:30:12 but I want to compare with 5/5/2009. I think the value of the based date is 5/5/2009 12:00:00 and that's why I couldn't query it.
The query is something like
dim db = new databcontext dim user = from u in db.datacontext where u.signUpTime = 5/5/2009 select u.
May someone please check this problem.
Thanks in advance.
Upvotes: 0
Views: 2275
Reputation: 422320
Your theory is correct. You should either use a range in your where clause:
u.SignupTime >= new DateTime(2009,5,5,0,0,0) AndAlso _
u.SignupTime < new DateTime(2009,5,6,0,0,0)
or check only the date:
u.SignupTime.Date = new DateTime(2009,5,5)
Upvotes: 1