Click here to Skip to main content
16,010,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,



I want to compare only the date part from datetime using linq,when am trying it's showing conversion error
Posted
Comments
Kornfeld Eliyahu Peter 26-May-14 5:03am    
Show your code with the error...

1 solution

Assuming it's a DateTime value, then it's simple: DateTime.Date[^] discards teh time portion, so the comparisons would be date only.

But that doesn't involve any conversions, so I suspect that you are trying to compare strings as dates and getting problems. Don't do that: convert your dates to DateTime and use them - the chances are that you have stored dates in you DB as strings, and as a result some of them are in incompatible formats, or just plain wrong. We can't help you there - you will have to fix your db design first and then convert your data.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900