I would like to know a simple algorithm to check if the given instance of datetime
lies between another two instances in C#
.
Note:
I skimmed though this How do I check if a given datetime object is "between" two datetimes? and it was for python and many more for php. Most of the other questions were regarding difference between the two.
Details:
I am more specific about the time, date does not matter to me. For example i got DataBase
entry for a staff who works between 10:00
Am - 9:00
Pm and I would like to know which staff is engaged in class at the given time like 2:00 Pm
. Now this would return me the staff's details who are engaged at this time.
Edit
After accepting the answer(been more than year back), i realized i had incorrectly described the problem. But all i think that was to be done back then was to do date and time comparison. So answers by both Jason and VikciaR work.