In asp mvc 4, I'm doing a query
where I'll get the data where hours are less than or equal to those entered by the user. That is, I have a dateTime
and I check with the variable entered by the user (a TimeSpan
) if it is lower or not.
For example:
-
In BD I have the data:
12-03-2014 12:00:00 12-03-2014 09:30:00 12-03-2014 18:00:00'
The user enters 10:00
and the result will be only:
12-03-2014 09:30:00
Now I do not know how to make this comparison. I've tried using TimeOfDay
but to no avail.
Code:
TimeSpan horaFim = new TimeSpan(10, 00, 00); //Simular variavel introduzida
var plan = db.Planeamento.Where(p => p.DataFimAssitencia.Value.TimeOfDay <= horaFim ).toList();