This is preliminary documentation and is subject to change.

TimeOnlyExtensions Class

The extension methods for working with TimeOnly objects.

Definition

Namespace: MoreDateTime.Extensions
Assembly: MoreDateTime (in MoreDateTime.dll) Version: 1.3.0
C#
public static class TimeOnlyExtensions
Inheritance
Object    TimeOnlyExtensions

Methods

AddMilliseconds Adds the given number of milliseconds to the given TimeOnly object
AddSeconds Adds the given number of seconds to the given TimeOnly object
AddTicks Adds the given number of ticks to the given TimeOnly object
Difference Calculates the difference of two TimeOnlyRanges. If the two ranges do not overlap, the result is the first TimeOnlyRange. Otherwise, the result is the first TimeOnlyRange without where both ranges overlap.
Distance Returns the distance as a TimeSpan between two TimeOnly objects. The result is always positive.
DoesOverlap Verifies if TimeOnlyRange a overlapps with TimeOnlyRange b.
EnumerateInStepsUntil(TimeOnly, TimeOnly, TimeSpan) Enumerates starting with the startTime date, until the endTime date in steps of distance
When the distance is negative, the start date must be greater than the end date, and the enumeration goes backwards
EnumerateInStepsUntil(TimeOnly, TimeOnly, TimeSpan, FuncTimeOnly, Boolean) Enumerates starting with startTime until endTime in steps of distance
Intersection Calculates the intersection of two TimeOnlyRanges. If the two ranges do not overlap, the result is an empty TimeOnlyRange. Otherwise, the result is the TimeOnlyRange that where both ranges overlap.
IsAfternoon Tests if the time in the given TimeOnly object is considered afternoon (12:00:00.000 - 18:00:00.000)
IsBetween Checks if the given value is between the given startTime and endTime values, not including start or end time
IsEqual Compares two dates for equality down to the given precision
IsEqualDownToHour Compares two dates for equality down to the hour (minutes, seconds and milliseconds are ignored)
IsEqualDownToMinute Compares two dates for equality down to the minute (seconds and milliseconds are ignored)
IsEqualDownToSecond Compares two dates for equality down to the second (milliseconds are ignored)
IsFullHour Tests if the time in the given TimeOnly object is midnight (0h)
IsFullMinute Tests if the time in the given TimeOnly object is midnight (0h)
IsMidday Tests if the time in the given TimeOnly object is midday (12h)
IsMidnight Tests if the time in the given TimeOnly object is midnight (0h)
IsMorning Tests if the time in the given TimeOnly object is midday (12:00:00.000)
IsNight Tests if the time in the given TimeOnly object is between 18:00:00 and 06:00:00
IsSameHour Verifies if the two instances are the same hour
IsSameMillisecond Verifies if the two dates are the same millisecond
IsSameMinute Verifies if the two dates are the same minute
IsSameSecond Verifies if the two instances are the same second
IsWithin(TimeOnly, TimeOnlyRange) Checks if the given value is between the given start and end values, including start date and end date
IsWithin(DateTime, TimeOnly, TimeOnly) Checks if the given value is between the given startTime and endTime values, including start or end time
IsWithin(TimeOnly, TimeOnly, TimeOnly) Checks if the given value is between the given startTime and endTime values, including start or end time
NextFullHour Gets the DateTime value of the next full hour (10:15 to 11:00, 10:45 to 11:00, etc)
NextFullMinute Gets the DateTime value of the next full minute (10:15:20 to 10:16:00)
NextFullSecond Gets the DateTime value of the next full second (10:15:20.350 to 10:15:21.000)
NextHour Gets the TimeOnly value of the next day
NextMillisecond Gets the TimeOnly value of the next millisecond
NextMinute Gets the TimeOnly value of the next day
NextSecond Gets the TimeOnly value of the next second
NumberOfHoursUntil Count the number of Hours between startTime and endTime
NumberOfMillisecondsUntil Count the number of Milliseconds between startTime and endTime
NumberOfMinutesUntil Count the number of Minutes between startTime and endTime
NumberOfSecondsUntil Count the number of Seconds between startTime and endTime
PreviousHour Gets the TimeOnly value of the Previous day
PreviousMillisecond Gets the TimeOnly value of the Previous day
PreviousMinute Gets the TimeOnly value of the Previous day
PreviousSecond Gets the TimeOnly value of the Previous day
Split(TimeOnlyRange, Int32) Splits the given range of TimeOnly into the given number of parts.
Split(TimeOnly, TimeOnly, Int32) Splits the given range of TimeOnly into the given number of parts.
Split(TimeOnly, TimeSpan, Int32) Splits the given range of TimeOnly into the given number of parts.
Sub Returns a new TimeOnly that subtracts the value of the specified TimeSpan from the value of this instance
TruncateTo Truncates the precision of a TimeOnly object to the given precision
TruncateToHour Truncates the precision of a TimeOnly object to the hour
TruncateToMinute Truncates the precision of a TimeOnly object to the minute
TruncateToSecond Truncates the precision of a TimeOnly object to the second
Union Calculates the union of two TimeOnlyRanges. If the two ranges do not overlap, the result is an empty TimeOnlyRange. Otherwise, the result is the TimeOnlyRange that contains both ranges.

See Also