6
On Asp mvc 4, I’m doing a query
where I find the data where the hours are lower or equal than those entered by the user. That is, I have a dateTime
and check with the user input variable (a TimeSpan
) whether it is inferior or not.
For example:
In the comic book I have the data:
12-03-2014 12:00:00 12-03-2014 09:30:00 12-03-2014 18:00:00`
The user inserts 10:00
and the result will be just:
12-03-2014 09:30:00
Now I don’t know how to make this comparison. I’ve tried using the TimeOfDay
but without success.
Code:
TimeSpan horaFim = new TimeSpan(10, 00, 00); //Simular variavel introduzida
var plan = db.Planeamento.Where(p => p.DataFimAssitencia.Value.TimeOfDay <= horaFim ).toList();