Answers for "c# time difference between two times"

C#
2

fdifference between two date in hours c#

double dif = (greaterDate - smallerDate).TotalHours;
Posted by: Guest on January-13-2021
-1

how to check if time is between two timespans in c#

if (interval.StartTime < interval.EndTime)
{
    // Normal case, e.g. 8am-2pm
    return interval.StartTime <= candidateTime && candidateTime < interval.EndTime;
}
else
{
    // Reverse case, e.g. 10pm-2am
    return interval.StartTime <= candidateTime || candidateTime < interval.EndTime;
}
Posted by: Guest on December-01-2020

Code answers related to "c# time difference between two times"

C# Answers by Framework

Browse Popular Code Answers by Language