Class CoordinatedUniversalTime
- Namespace
- Codebelt.SharedKernel
- Assembly
- Codebelt.SharedKernel.dll
Represents a CoordinatedUniversalTime (UTC) object that can be used when you need a timestamp that is based on an absolute time.
public class CoordinatedUniversalTime : ComparableValueObject<DateTime>, IEquatable<ValueObject>, IEquatable<SingleValueObject<DateTime>>, IComparisonOperators<ComparableValueObject<DateTime>, ComparableValueObject<DateTime>, bool>, IEqualityOperators<ComparableValueObject<DateTime>, ComparableValueObject<DateTime>, bool>, IEquatable<ComparableValueObject<DateTime>>, IEquatable<CoordinatedUniversalTime>
- Inheritance
-
ObjectSingleValueObject<DateTime>ComparableValueObject<DateTime>CoordinatedUniversalTime
- Implements
-
IEquatable<ValueObject>IEquatable<CoordinatedUniversalTime>
- Inherited Members
-
SingleValueObject<DateTime>.PrintMembers(StringBuilder)SingleValueObject<DateTime>.GetHashCode()SingleValueObject<DateTime>.Equals(Object)SingleValueObject<DateTime>.Equals(ValueObject)SingleValueObject<DateTime>.Equals(SingleValueObject<DateTime>)SingleValueObject<DateTime>.<Clone>$()SingleValueObject<DateTime>.EqualityContract
Remarks
Constructors
CoordinatedUniversalTime(DateTime)
Initializes a new instance of the CoordinatedUniversalTime class.
public CoordinatedUniversalTime(DateTime value)
Parameters
value
DateTimeThe System.DateTime value to assign the role of CoordinatedUniversalTime.
Exceptions
- System.ArgumentException
value
is not in a valid state, e.g., it's different from System.DateTimeKind.Utc.
Fields
MaxValue
Denotes the largest possible value of CoordinatedUniversalTime.
public static readonly CoordinatedUniversalTime MaxValue
Field Value
MinValue
Denotes the smallest possible value of CoordinatedUniversalTime.
public static readonly CoordinatedUniversalTime MinValue
Field Value
Methods
FromString(String)
Converts the string representation of a date and time to its CoordinatedUniversalTime> equivalent.
public static CoordinatedUniversalTime FromString(string value)
Parameters
value
StringA string that contains a date and time to convert.
Returns
- CoordinatedUniversalTime
A new instance of CoordinatedUniversalTime that represents
value
.
Now()
Returns a CoordinatedUniversalTime whose value is the current UTC date and time.
public static CoordinatedUniversalTime Now()
Returns
- CoordinatedUniversalTime
A new instance of CoordinatedUniversalTime set to the current date and time on this computer.
ToString()
Returns a System.String> that represents this instance and complies with ISO 8601.
public override string ToString()
Returns
- String
A System.String> that represents this instance and complies with ISO 8601.
Operators
Implicit(CoordinatedUniversalTime to DateTime)
Performs an implicit conversion from CoordinatedUniversalTime to System.DateTime.
public static implicit operator DateTime(CoordinatedUniversalTime value)
Parameters
value
CoordinatedUniversalTimeThe value to convert.
Returns
- DateTime
A System.DateTime that is equivalent to
value
.
Implicit(DateTime to CoordinatedUniversalTime)
Performs an implicit conversion from System.DateTime to CoordinatedUniversalTime.
public static implicit operator CoordinatedUniversalTime(DateTime value)
Parameters
value
DateTimeThe value to convert.
Returns
- CoordinatedUniversalTime
A CoordinatedUniversalTime that is equivalent to
value
.
Implicit(DateTimeOffset to CoordinatedUniversalTime)
Performs an implicit conversion from System.DateTimeOffset to CoordinatedUniversalTime.
public static implicit operator CoordinatedUniversalTime(DateTimeOffset value)
Parameters
value
DateTimeOffsetThe value to convert.
Returns
- CoordinatedUniversalTime
A CoordinatedUniversalTime that is equivalent to
value
.