Click here to Skip to main content
13,050,358 members (139,777 online)
Rate this:
Please Sign up or sign in to vote.
See more:
My database has stored the date and time value i.e., with datatype Datetime.
I use Entity framework.
I want to check the fields with given date and extract only those records.

var query = from h in test.sample
where h.BDate.Value.Date==calender1.selectedDate.Date
select h;

The above code is not working.

I also used entityfunctions.truncatetime() whiich also does not favours me.

help me to extract only date from datetime datatype.

Posted 28-Feb-13 2:59am
ThePhantomUpvoter 28-Feb-13 9:08am
Try your query with one = and see what happens.
sri senthil kumar 1-Mar-13 7:50am
check whether ToShortDateString() helps you...
lindam88 8-Mar-13 21:30pm
for different date formats visit this-->
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

try this link...
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

you can use a format string

DateTime time = Date Time.Now;
String format = "MMM ddd d HH:mm yyyy";

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 13 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100