Struct SwiftTime
Represents a time within a day, accurate to a second. This structure can be
logically null.
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 |
DateTime |
tTime |
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.
Declaration
public SwiftTime(int nHour, int nMinute, int nSecond)
Parameters
Type |
Name |
Description |
int |
nHour |
Hour in the range from 0 through 23.
|
int |
nMinute |
Minute in the range from 0 through 59.
|
int |
nSecond |
Second in the range from 0 through 59.
|
Exceptions
Type |
Condition |
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 |
int |
This allowed range of this property is 0 through 23.
|
Exceptions
Type |
Condition |
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 bool IsNull { get; }
Property Value
Minute
Declaration
public int Minute { get; set; }
Property Value
Type |
Description |
int |
This allowed range of this property is 0 through 59.
|
Exceptions
Type |
Condition |
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 |
int |
This allowed range of this property is 0 through 59.
|
Exceptions
Type |
Condition |
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 |
DateTime |
tDateTime |
|
Returns
CompareTo(object)
Implements IComparable.CompareTo.
Declaration
public int CompareTo(object obj)
Parameters
Type |
Name |
Description |
object |
obj |
Other SwiftTime to compare to.
|
Returns
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
object |
obj |
|
Returns
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
Parse(string)
Declaration
public static SwiftTime Parse(string sStringTime)
Parameters
Type |
Name |
Description |
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 |
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.
Declaration
public override string ToString()
Returns
Type |
Description |
string |
Returns the converted time.
|
Overrides
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 |
string |
Returns the converted date.
|
ToString(bool)
This method is deprecated!
Declaration
public string ToString(bool fLongFormat)
Parameters
Type |
Name |
Description |
bool |
fLongFormat |
|
Returns
TryParse(string)
Declaration
public static SwiftTime TryParse(string sStringTime)
Parameters
Type |
Name |
Description |
string |
sStringTime |
|
Returns
Operators
operator ==(SwiftTime, SwiftTime)
Declaration
public static bool operator ==(SwiftTime lhs, SwiftTime rhs)
Parameters
Returns
operator >(SwiftTime, SwiftTime)
Declaration
public static bool operator >(SwiftTime lhs, SwiftTime rhs)
Parameters
Returns
operator >=(SwiftTime, SwiftTime)
Declaration
public static bool operator >=(SwiftTime lhs, SwiftTime rhs)
Parameters
Returns
operator !=(SwiftTime, SwiftTime)
Declaration
public static bool operator !=(SwiftTime lhs, SwiftTime rhs)
Parameters
Returns
operator <(SwiftTime, SwiftTime)
Declaration
public static bool operator <(SwiftTime lhs, SwiftTime rhs)
Parameters
Returns
operator <=(SwiftTime, SwiftTime)
Declaration
public static bool operator <=(SwiftTime lhs, SwiftTime rhs)
Parameters
Returns
Implements