Struct SwiftTime
Represents a time within a day, accurate to a second. This structure can be
logically null.
Implements
System.IComparable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Subsembly.Sepa.dll
Syntax
public struct SwiftTime : IComparable
Constructors
SwiftTime(DateTime)
Constructs a SwiftTime instance from the time portion of a System.DateTime.
Declaration
public SwiftTime(DateTime tTime)
Parameters
Type |
Name |
Description |
System.DateTime |
tTime |
System.DateTime instance that provides the time. Only the Hour, Minute and Second
properties from this instance are used.
|
SwiftTime(Int32, Int32, Int32)
Constructs a SwiftTime instance with the given time.
Declaration
public SwiftTime(int nHour, int nMinute, int nSecond)
Parameters
Type |
Name |
Description |
System.Int32 |
nHour |
Hour in the range from 0 through 23.
|
System.Int32 |
nMinute |
Minute in the range from 0 through 59.
|
System.Int32 |
nSecond |
Second in the range from 0 through 59.
|
Exceptions
Type |
Condition |
System.ArgumentOutOfRangeException |
If any of the arguments is outside the allowed range, then an
ArgumentOutOfRangeException will be thrown.
|
Fields
NullTime
Declaration
public static readonly SwiftTime NullTime
Field Value
Properties
Hour
Declaration
public int Hour { get; set; }
Property Value
Type |
Description |
System.Int32 |
This allowed range of this property is 0 through 23.
|
Exceptions
Type |
Condition |
System.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.
Declaration
public readonly bool IsNull { get; }
Property Value
Type |
Description |
System.Boolean |
|
Minute
Declaration
public int Minute { get; set; }
Property Value
Type |
Description |
System.Int32 |
This allowed range of this property is 0 through 59.
|
Exceptions
Type |
Condition |
System.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
Declaration
public int Second { get; set; }
Property Value
Type |
Description |
System.Int32 |
This allowed range of this property is 0 through 59.
|
Exceptions
Type |
Condition |
System.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)
Declaration
public DateTime AddTime(DateTime tDateTime)
Parameters
Type |
Name |
Description |
System.DateTime |
tDateTime |
|
Returns
Type |
Description |
System.DateTime |
|
CompareTo(Object)
Implements IComparable.CompareTo.
Declaration
public int CompareTo(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
Other SwiftTime to compare to.
|
Returns
Type |
Description |
System.Int32 |
|
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
System.ValueType.Equals(System.Object)
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.ValueType.GetHashCode()
Parse(String)
Declaration
public static SwiftTime Parse(string sStringTime)
Parameters
Type |
Name |
Description |
System.String |
sStringTime |
Date to be parsed in one of the following formats: HH:MM:SS, HHMMSS, HH:MM, or
HHMM.
|
Returns
Type |
Description |
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
Type |
Condition |
System.ArgumentNullException |
If the given string is null, then an ArgumentNullException will be thrown.
|
System.ArgumentException |
The given sStringTime does not have a length of 4, 5, 6 or 8 characters.
|
System.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.
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
Returns the converted time.
|
Overrides
System.ValueType.ToString()
Converts this time to a string representation in the format specified.
Declaration
public string ToString(SwiftTimeFormat nTimeFormat)
Parameters
Type |
Name |
Description |
SwiftTimeFormat |
nTimeFormat |
Selects the format to be used for the generated time string.
|
Returns
Type |
Description |
System.String |
Returns the converted date.
|
ToString(Boolean)
This method is deprecated!
Declaration
public string ToString(bool fLongFormat)
Parameters
Type |
Name |
Description |
System.Boolean |
fLongFormat |
|
Returns
Type |
Description |
System.String |
|
Operators
Equality(SwiftTime, SwiftTime)
Declaration
public static bool operator ==(SwiftTime lhs, SwiftTime rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
GreaterThan(SwiftTime, SwiftTime)
Declaration
public static bool operator>(SwiftTime lhs, SwiftTime rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
GreaterThanOrEqual(SwiftTime, SwiftTime)
Declaration
public static bool operator >=(SwiftTime lhs, SwiftTime rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Inequality(SwiftTime, SwiftTime)
Declaration
public static bool operator !=(SwiftTime lhs, SwiftTime rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
LessThan(SwiftTime, SwiftTime)
Declaration
public static bool operator <(SwiftTime lhs, SwiftTime rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
LessThanOrEqual(SwiftTime, SwiftTime)
Declaration
public static bool operator <=(SwiftTime lhs, SwiftTime rhs)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Implements
System.IComparable