Hi there,
Well i have a big problem formatting the datetime variable to suit my needs and no matter how much i dag i havnt found the right solution.
I'll show you the code im writting and explain.
I have this method
public static List<Reservation> GetReservationsReportBySites(List<Site> sites, DateTime fromDate, DateTime toDate, DateTime fromTime, DateTime toTime, ReservationStatus status)
The method recieve a few datetime variables, now what im trying to do with them is to define which reservations i want the application to show, in the database i have also 4 datetime two of them are from and to date without the actual hour and the other two are the from and to time without the actual hour (i cant change it, it and old database from work).
How do i make so that i will compare the dates and time the user pick with those four variables, i know i need to somehow break the datetime to date and time but im unable to do that.
this is the code of what i was thinking that will work to sort the reservations.
var item in data.Where(p => p.StartDate.Value >=
fromDate.Date && p.StartDate.Value >=
fromTime && p.Valid == isValid &&
p.EndDate.Value<= toDate && p.EndDate.Value <= toTime))
as you can see im trying to use LINQ and im also learning it as i go so i'll take all the help i will get.
thanks in advance.