Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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;
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: List picking records from database 
Csharp :: how to check if string from textbox exists in db 
Csharp :: make tooltip disappear c# 
Csharp :: my custom file watcher 
Csharp :: generate an mvc controller when dotnet core command line 
Csharp :: satisfactory controller support 
Csharp :: c# string .contains against empty string returns 
Csharp :: material.icons for wpf 
Csharp :: c# summary angle brackets 
Csharp :: afaik 
Csharp :: mouse position to canvas transform 
Csharp :: c# string size in bytes 
Csharp :: return every digit on a string c# 
Csharp :: unity roam, chase, attack states 
Csharp :: C# replace all . except last one 
Csharp :: blender how to switch cameras 
Csharp :: IdentityServer vs JWT vs OAuth? 
Csharp :: c# change chart legend font size 
Csharp :: trigger checkbox combobox wpf 
Csharp :: All and Any linq c# examlpe replace 
Csharp :: c# use list as a paramter 
Csharp :: ilist validation wpf mvvm 
Csharp :: BOTON PARA CAMBIAR DE VIEW ASP.NET 
Csharp :: connection string of bulk insert with csv in c# 
Csharp :: c# check word length 
Csharp :: Permutation and Combination in C# 
Csharp :: how to use javascriptexecutor for loop in selenium c# 
Csharp :: get image information using c# 
Csharp :: how to not overwrite a text file in c# 
Csharp :: thread c# 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =