CosmosTime.UtcTime - osexpert/CosmosTime GitHub Wiki

UtcTime Struct

TODO

public struct UtcTime :
System.IEquatable<CosmosTime.UtcTime>,
System.IComparable<CosmosTime.UtcTime>,
System.IComparable

Implements System.IEquatable<UtcTime>, System.IComparable<UtcTime>, System.IComparable

Constructors
UtcTime(int, int, int) year, month, day, etc. is time in Utc
UtcTime(int, int, int, int, int, int) year, month, day, etc. is time in Utc
UtcTime(int, int, int, int, int, int, int) year, month, day, etc. is time in Utc
Fields
MaxValue Seems like a bug in DateTime:
DateTime.MaxValue.ToUniversalTime().Ticks -> 3155378939999999999 // no...not UTC max (its lower)
DateTimeOffset.MaxValue.Ticks -> 3155378975999999999 // correct
new DateTime(0x2bca2875f4373fffL, DateTimeKind.Utc).Ticks -> 3155378975999999999 // correct
MinValue TODO
Properties
Date Date in Utc
Now Now in Utc
Ticks Ticks in utc
TimeOfDay TimeOfDay in Utc
UtcDateTime Kind is always Utc
Naming: DateTimeOffset has UtcDateTime and LocalDateTime, so follow same naming {kind}DateTime
Methods
AddDays(double) TODO
AddHours(double) TODO
AddMinutes(double) TODO
AddSeconds(double) TODO
CompareTo(UtcTime) TODO
Equals(UtcTime) TODO
kind of both is utc
Equals(object) TODO
FromLocalDateTime(DateTime) DateTime must be Local, else will throw
FromUnspecifiedDateTime(DateTime, TimeSpan) Offset is only used if Kind is Unspecified
FromUnspecifiedDateTime(DateTime, TimeZoneInfo) TODO
FromUtcDateTime(DateTime) DateTime must be Kind Utc, else will throw
GetHashCode() Returns the hash code for this instance.
Parse(string) Only allows Iso formats {utc}Z or {local}[+-]{offset}
Parse(string, Func<DateTimeOffset,TimeSpan>) TODO
ParseCosmosDb(string) Parse Utc fixed length format with 28 chars and ending with Z.
Example: 2020-01-20T12:13:14.0000000Z
ToCosmosDb() Fixed length (28 chars) Iso format in Utc.
Example: 2020-01-20T12:13:14.0000000Z
ToString() Iso format with variable length milliseconds in utc (Z)
Examples:
2020-01-20T12:13:14.1234Z
2020-01-20T12:13:14.123Z
2020-01-20T12:13:14.123456Z
TryParse(string, UtcTime) Parse any Iso time in utc or local[+-]offset. Example:


2020-01-01Z

2020-01-01T12:12:12Z

2020-01-01T12:12:12.123Z

2020-01-01T12:12:12.123+00:30

Time without zone can not be parsed. Example:


2020-01-01T12:12:12.123
TryParse(string, UtcTime, Func<DateTimeOffset,TimeSpan>) TODO
Operators
operator +(UtcTime, TimeSpan) TODO
operator ==(UtcTime, UtcTime) TODO
operator >(UtcTime, UtcTime) TODO
operator >=(UtcTime, UtcTime) TODO
operator !=(UtcTime, UtcTime) TODO
operator <(UtcTime, UtcTime) TODO
operator <=(UtcTime, UtcTime) TODO
operator -(UtcTime, UtcTime) TODO
operator -(UtcTime, TimeSpan) TODO
⚠️ **GitHub.com Fallback** ⚠️