TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Lawrence Pond
NA
164
0
Linq datetime use only the date portion to compare list
Oct 23 2014 8:10 PM
The following code, has two lists of dates one is a list of course date (courseDateList) the other is the selected dates (selectedDateList). I want to find the dates
that are in the
courseDateList
but are
not in
the selectedDateList.
Compare only the date portion not the time of the selectedDateList or courseDateList
So the expected output should be:
5/7/2014 7:00:00 AM
5/7/2014 12:00:00 PM
void Main()
{
var courseDateList = new[]
{
new Dates { Start= Convert.ToDateTime("05/05/2014 07:00:00 AM")},
new Dates { Start= Convert.ToDateTime("05/05/2014 12:00:00 PM")},
new Dates { Start = Convert.ToDateTime("05/06/2014 07:00:00 AM")},
new Dates { Start = Convert.ToDateTime("05/06/2014 12:00:00 PM")},
new Dates { Start= Convert.ToDateTime("05/07/2014 07:00:00 AM")},
new Dates { Start= Convert.ToDateTime("05/07/2014 12:00:00 PM")}
};
var selectedDateList = new[]
{
new Dates { Start= Convert.ToDateTime("05/05/2014 08:00:00 AM")},
new Dates { Start= Convert.ToDateTime("05/06/2014 05:00:00 PM")}
};
selectedDateList.Dump();
courseDateList.Dump();
}
public class Dates
{
public DateTime Start {get; set;}
}
Reply
Answers (
3
)
How to iterate through result where one field is collection
Entity Framework