How to judge whether the current time in the task time
CodePudding user response:
Datetime and timespan can directly compare the sizeCodePudding user response:
Time, datetime.com pare said, or calculate the difference timespan, poor judgment value attributeCodePudding user response:
TimestampTimeSpan start=TimeSpan. Parse (" 30 ");
TimeSpan end=TimeSpan. Parse (" 03:30 ");
Var q=a DateTime. Now. TimeOfDay;
Var result=! (q & lt;=start & amp; & Q & gt;=end);
Console. WriteLine (result);
CodePudding user response:
DataTime set the starting time of the next time the begin, end set over time, and then use a DateTime. Now. The sub minus the start time and end time, if the resulting value greater than 0, is greater than the start or end time, it is ok to this time in accordance with the business judgment,CodePudding user response:
We can use jutils - isDuringDate JavaScript libraries commonly used function to implementMethod of use:
JavaScript to compare whether the current time within a specified time period
Source:
CodePudding user response:
datediffCodePudding user response:
Datetime1 - datetime2=what a TimeSpan and then judge the minutes is ok, so old post also out,