如何知道JobStart和&之间的当前时间(不是日期)。工作结束时间
var JobStartTime = new DateTime(2012,1,1,9,0,0,DateTimeKind.Local); //09:00AM
var JobEndTime = new DateTime(2012,1,1,18,0,0,DateTimeKind.Local); //06:00PM
var CurrentTime = DateTime.Now;
答案 0 :(得分:3)
if (CurrentTime.TimeOfDay >= JobStartTime.TimeOfDay &&
CurrentTime.TimeOfDay <= JobEndTime.TimeOfDay)
{
}