i want to check the time that falls into two different date. assume that i need to check from 10:30pm from this day up to 7am of tomorrow.
TimeSpan NightShiftStart = new TimeSpan(22, 30, 0);//10:30pm
TimeSpan NightShiftEnd = new TimeSpan(7, 0, 0); //7am
and compare it
if ((now > NightShiftStart ) && (now < NightShiftEnd )){}
timespan wont work on this i also tried
DateTime t1 = DateTime.Today.AddHours(22);
DateTime t2 = DateTime.Today.AddDays(1).AddHours(7);
still no luck.
DateTimeas that should work. Thought you forgotAddMinutes(30). Also if you are always working with todays dates then you really only want to know if the time is after 10:30 pm since it's never tomorrow.