TimeOnly.IsBetween(TimeOnly, TimeOnly) Method

Definition

Determines if a time falls within the range provided. Supports both "normal" ranges such as 10:00-12:00, and ranges that span midnight such as 23:00-01:00.

public:
 bool IsBetween(TimeOnly start, TimeOnly end);
public bool IsBetween (TimeOnly start, TimeOnly end);
member this.IsBetween : TimeOnly * TimeOnly -> bool
Public Function IsBetween (start As TimeOnly, end As TimeOnly) As Boolean

Parameters

start
TimeOnly

The starting time of day, inclusive.

end
TimeOnly

The ending time of day, exclusive.

Returns

true, if the time falls within the range, false otherwise.

Remarks

If start and end are equal, this method returns false, meaning there is zero elapsed time between the two values. If you wish to treat such cases as representing one or more whole days, then first check for equality before calling this method.

Applies to