var start = new TimeSpan(2, 45, 0); var end = new TimeSpan(4, 0, 0); var now = DateTime.Now.TimeOfDay; if ((now > start) && (now < end)) { return; }