Struct SwiftTime

Namespace
Subsembly.Swift
Assembly
Subsembly.Sepa.dll

Represents a time within a day, accurate to a second. This structure can be logically null.

public struct SwiftTime : IComparable
Implements
Inherited Members

Remarks

An unconstructed instance of this structure is considered to have a null value.

Constructors

SwiftTime(DateTime)

Constructs a SwiftTime instance from the time portion of a System.DateTime.

public SwiftTime(DateTime tTime)

Parameters

tTime DateTime

System.DateTime instance that provides the time. Only the Hour, Minute and Second properties from this instance are used.

SwiftTime(int, int, int)

Constructs a SwiftTime instance with the given time.

public SwiftTime(int nHour, int nMinute, int nSecond)

Parameters

nHour int

Hour in the range from 0 through 23.

nMinute int

Minute in the range from 0 through 59.

nSecond int

Second in the range from 0 through 59.

Exceptions

ArgumentOutOfRangeException

If any of the arguments is outside the allowed range, then an ArgumentOutOfRangeException will be thrown.

Fields

NullTime

Represents a null time.

public static readonly SwiftTime NullTime

Field Value

SwiftTime

Properties

Hour

The hour of this time.

public int Hour { get; set; }

Property Value

int

This allowed range of this property is 0 through 23.

Exceptions

ArgumentOutOfRangeException

An attempt to set the hour to a value outside of the allowed range 0 through 23 will cause an ArgumentOutOfRangeException to be thrown.

IsNull

Indicates whether this SwiftTime instance is logically null.

public bool IsNull { get; }

Property Value

bool

Minute

The minute of this time.

public int Minute { get; set; }

Property Value

int

This allowed range of this property is 0 through 59.

Exceptions

ArgumentOutOfRangeException

An attempt to set the minute to a value outside of the allowed range 0 through 59 will cause an ArgumentOutOfRangeException to be thrown.

Second

The second of this time.

public int Second { get; set; }

Property Value

int

This allowed range of this property is 0 through 59.

Exceptions

ArgumentOutOfRangeException

An attempt to set the second to a value outside of the allowed range 0 through 59 will cause an ArgumentOutOfRangeException to be thrown.

Methods

AddTime(DateTime)

public DateTime AddTime(DateTime tDateTime)

Parameters

tDateTime DateTime

Returns

DateTime

CompareTo(object)

Implements IComparable.CompareTo.

public int CompareTo(object obj)

Parameters

obj object

Other SwiftTime to compare to.

Returns

int

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

Parse(string)

Parses a string time.

public static SwiftTime Parse(string sStringTime)

Parameters

sStringTime string

Date to be parsed in one of the following formats: HH:MM:SS, HHMMSS, HH:MM, or HHMM.

Returns

SwiftTime

Returns a new instance of the SwiftTime class that is initialised with the parsed time. If no seconds have been given, then the Second will be zero.

Exceptions

ArgumentNullException

If the given string is null, then an ArgumentNullException will be thrown.

ArgumentException

The given sStringTime does not have a length of 4, 5, 6 or 8 characters.

FormatException

If the given string is not in one of the acceptable formats, or the hour, minute or second are outside of the allowed range, then a FormatException is thrown.

ToString()

Converts this time to a string in the format HHMMSS.

public override string ToString()

Returns

string

Returns the converted time.

Remarks

This is an overloaded convenience method that internally just calls ToString(SwiftTimeFormat) requesting the SwiftTimeHHMMSS.

ToString(SwiftTimeFormat)

Converts this time to a string representation in the format specified.

public string ToString(SwiftTimeFormat nTimeFormat)

Parameters

nTimeFormat SwiftTimeFormat

Selects the format to be used for the generated time string.

Returns

string

Returns the converted date.

ToString(bool)

This method is deprecated!

public string ToString(bool fLongFormat)

Parameters

fLongFormat bool

Returns

string

TryParse(string)

public static SwiftTime TryParse(string sStringTime)

Parameters

sStringTime string

Returns

SwiftTime

Operators

operator ==(SwiftTime, SwiftTime)

public static bool operator ==(SwiftTime lhs, SwiftTime rhs)

Parameters

lhs SwiftTime
rhs SwiftTime

Returns

bool

operator >(SwiftTime, SwiftTime)

public static bool operator >(SwiftTime lhs, SwiftTime rhs)

Parameters

lhs SwiftTime
rhs SwiftTime

Returns

bool

operator >=(SwiftTime, SwiftTime)

public static bool operator >=(SwiftTime lhs, SwiftTime rhs)

Parameters

lhs SwiftTime
rhs SwiftTime

Returns

bool

operator !=(SwiftTime, SwiftTime)

public static bool operator !=(SwiftTime lhs, SwiftTime rhs)

Parameters

lhs SwiftTime
rhs SwiftTime

Returns

bool

operator <(SwiftTime, SwiftTime)

public static bool operator <(SwiftTime lhs, SwiftTime rhs)

Parameters

lhs SwiftTime
rhs SwiftTime

Returns

bool

operator <=(SwiftTime, SwiftTime)

public static bool operator <=(SwiftTime lhs, SwiftTime rhs)

Parameters

lhs SwiftTime
rhs SwiftTime

Returns

bool