Struct HourMinute
Represents a time instance with the hour and minute.
public struct HourMinute : IEquatable<HourMinute>, IHasHour, IHasMinute, ITimeObject
- Implements
- Inherited Members
- Extension Methods
Constructors
HourMinute(int)
Initializes a new instance of the HourMinute struct from the total minutes of the time.
public HourMinute(int totalMinutes)
Parameters
totalMinutesintThe total minutes of the time.
HourMinute(int, int)
Initializes a new instance of the HourMinute struct from the hour and the minute of the time.
public HourMinute(int hour, int minute)
Parameters
Properties
Hour
Gets or sets the hour.
public int Hour { get; set; }
Property Value
Minute
Gets or sets the minute.
public int Minute { get; set; }
Property Value
NextHour
Gets the HourMinute representation of the next hour from the current time.
public static HourMinute NextHour { get; }
Property Value
NextMinute
Gets the HourMinute representation of the next minute from the current time.
public static HourMinute NextMinute { get; }
Property Value
Now
Gets the current time's HourMinute representation.
public static HourMinute Now { get; }
Property Value
TotalHours
Gets or sets the total hours as a double.
public double TotalHours { get; set; }
Property Value
TotalMinutes
Gets or sets the total minutes.
public int TotalMinutes { get; set; }
Property Value
TotalSeconds
Gets the total seconds.
public int TotalSeconds { get; }
Property Value
Methods
Add(int)
Adds a number of minutes to the time of this instance.
public void Add(int minutes)
Parameters
minutesintThe minutes to add.
Add(int, int)
Adds a number of minutes to the time of this instance.
public void Add(int hours, int minutes)
Parameters
Equals(HourMinute)
Determines whether another HourMinute instance is equal to this one.
public bool Equals(HourMinute other)
Parameters
otherHourMinuteThe other HourMinute instance.
Returns
- bool
A value determining whether both objects are equal or not.
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Parse(string)
Parses the given string representation of an hour-minute time into a HourMinute instance.
public static HourMinute Parse(string s)
Parameters
sstringThe string representation of an hour-minute of the form "HH:MM". The string may contain additional numbers split with ":", which will be ignored.
Returns
- HourMinute
The parsed HourMinute instance.
Subtract(int)
Subtracts a number of minutes from the time of this instance.
public void Subtract(int minutes)
Parameters
minutesintThe minutes to subtract.
Subtract(int, int)
Subtracts a number of minutes from the time of this instance.
public void Subtract(int hours, int minutes)
Parameters
ToString()
Gets the string representation of the hour-minute time.
public override string ToString()
Returns
- string
The string representation of the hour-minute time in the form "HH:MM".
Operators
operator +(HourMinute, HourMinute)
public static HourMinute operator +(HourMinute left, HourMinute right)
Parameters
leftHourMinuterightHourMinute
Returns
operator +(HourMinute, int)
public static HourMinute operator +(HourMinute hm, int minutes)
Parameters
hmHourMinuteminutesint
Returns
operator ==(HourMinute, HourMinute)
public static bool operator ==(HourMinute left, HourMinute right)
Parameters
leftHourMinuterightHourMinute
Returns
explicit operator HourMinute(DateTime)
public static explicit operator HourMinute(DateTime t)
Parameters
tDateTime
Returns
explicit operator HourMinute(DateTimeOffset)
public static explicit operator HourMinute(DateTimeOffset t)
Parameters
Returns
explicit operator HourMinute(TimeSpan)
public static explicit operator HourMinute(TimeSpan t)
Parameters
tTimeSpan
Returns
operator >(HourMinute, HourMinute)
public static bool operator >(HourMinute left, HourMinute right)
Parameters
leftHourMinuterightHourMinute
Returns
operator >=(HourMinute, HourMinute)
public static bool operator >=(HourMinute left, HourMinute right)
Parameters
leftHourMinuterightHourMinute
Returns
implicit operator DateTime(HourMinute)
public static implicit operator DateTime(HourMinute t)
Parameters
Returns
implicit operator DateTimeOffset(HourMinute)
public static implicit operator DateTimeOffset(HourMinute t)
Parameters
Returns
implicit operator TimeSpan(HourMinute)
public static implicit operator TimeSpan(HourMinute t)
Parameters
Returns
operator !=(HourMinute, HourMinute)
public static bool operator !=(HourMinute left, HourMinute right)
Parameters
leftHourMinuterightHourMinute
Returns
operator <(HourMinute, HourMinute)
public static bool operator <(HourMinute left, HourMinute right)
Parameters
leftHourMinuterightHourMinute
Returns
operator <=(HourMinute, HourMinute)
public static bool operator <=(HourMinute left, HourMinute right)
Parameters
leftHourMinuterightHourMinute
Returns
operator -(HourMinute, HourMinute)
public static HourMinute operator -(HourMinute left, HourMinute right)
Parameters
leftHourMinuterightHourMinute
Returns
operator -(HourMinute, int)
public static HourMinute operator -(HourMinute hm, int minutes)
Parameters
hmHourMinuteminutesint