Y
yu_ting
Unregistered / Unconfirmed
GUEST, unregistred user!
我是这样做的:
public static bool BetweenTime(DateTime time1, DateTime time, DateTime time2)
{
return ((time.TimeOfDay >= time1.TimeOfDay) &&
(time.TimeOfDay <= time2.TimeOfDay));
}
我只需要精确到秒就可以了,但是返回的结果不正确,好像TimeOfDay是精确到毫秒的,但参数time只能精确到秒.各位有什么好办法?
public static bool BetweenTime(DateTime time1, DateTime time, DateTime time2)
{
return ((time.TimeOfDay >= time1.TimeOfDay) &&
(time.TimeOfDay <= time2.TimeOfDay));
}
我只需要精确到秒就可以了,但是返回的结果不正确,好像TimeOfDay是精确到毫秒的,但参数time只能精确到秒.各位有什么好办法?