Table of Contents

Struct HourMinute

Namespace
Garyon.Objects
Assembly
Garyon.dll

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

totalMinutes int

The 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

hour int

The hour of the time.

minute int

The minute of the time.

Properties

Hour

Gets or sets the hour.

public int Hour { get; set; }

Property Value

int

Minute

Gets or sets the minute.

public int Minute { get; set; }

Property Value

int

NextHour

Gets the HourMinute representation of the next hour from the current time.

public static HourMinute NextHour { get; }

Property Value

HourMinute

NextMinute

Gets the HourMinute representation of the next minute from the current time.

public static HourMinute NextMinute { get; }

Property Value

HourMinute

Now

Gets the current time's HourMinute representation.

public static HourMinute Now { get; }

Property Value

HourMinute

TotalHours

Gets or sets the total hours as a double.

public double TotalHours { get; set; }

Property Value

double

TotalMinutes

Gets or sets the total minutes.

public int TotalMinutes { get; set; }

Property Value

int

TotalSeconds

Gets the total seconds.

public int TotalSeconds { get; }

Property Value

int

Methods

Add(int)

Adds a number of minutes to the time of this instance.

public void Add(int minutes)

Parameters

minutes int

The 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

hours int

The hours to add.

minutes int

The minutes to add.

Equals(HourMinute)

Determines whether another HourMinute instance is equal to this one.

public bool Equals(HourMinute other)

Parameters

other HourMinute

The 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

obj object

The object to compare with the current instance.

Returns

bool

true if obj and 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

s string

The 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

minutes int

The 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

hours int

The hours to subtract.

minutes int

The minutes to subtract.

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

left HourMinute
right HourMinute

Returns

HourMinute

operator +(HourMinute, int)

public static HourMinute operator +(HourMinute hm, int minutes)

Parameters

hm HourMinute
minutes int

Returns

HourMinute

operator ==(HourMinute, HourMinute)

public static bool operator ==(HourMinute left, HourMinute right)

Parameters

left HourMinute
right HourMinute

Returns

bool

explicit operator HourMinute(DateTime)

public static explicit operator HourMinute(DateTime t)

Parameters

t DateTime

Returns

HourMinute

explicit operator HourMinute(DateTimeOffset)

public static explicit operator HourMinute(DateTimeOffset t)

Parameters

t DateTimeOffset

Returns

HourMinute

explicit operator HourMinute(TimeSpan)

public static explicit operator HourMinute(TimeSpan t)

Parameters

t TimeSpan

Returns

HourMinute

operator >(HourMinute, HourMinute)

public static bool operator >(HourMinute left, HourMinute right)

Parameters

left HourMinute
right HourMinute

Returns

bool

operator >=(HourMinute, HourMinute)

public static bool operator >=(HourMinute left, HourMinute right)

Parameters

left HourMinute
right HourMinute

Returns

bool

implicit operator DateTime(HourMinute)

public static implicit operator DateTime(HourMinute t)

Parameters

t HourMinute

Returns

DateTime

implicit operator DateTimeOffset(HourMinute)

public static implicit operator DateTimeOffset(HourMinute t)

Parameters

t HourMinute

Returns

DateTimeOffset

implicit operator TimeSpan(HourMinute)

public static implicit operator TimeSpan(HourMinute t)

Parameters

t HourMinute

Returns

TimeSpan

operator !=(HourMinute, HourMinute)

public static bool operator !=(HourMinute left, HourMinute right)

Parameters

left HourMinute
right HourMinute

Returns

bool

operator <(HourMinute, HourMinute)

public static bool operator <(HourMinute left, HourMinute right)

Parameters

left HourMinute
right HourMinute

Returns

bool

operator <=(HourMinute, HourMinute)

public static bool operator <=(HourMinute left, HourMinute right)

Parameters

left HourMinute
right HourMinute

Returns

bool

operator -(HourMinute, HourMinute)

public static HourMinute operator -(HourMinute left, HourMinute right)

Parameters

left HourMinute
right HourMinute

Returns

HourMinute

operator -(HourMinute, int)

public static HourMinute operator -(HourMinute hm, int minutes)

Parameters

hm HourMinute
minutes int

Returns

HourMinute