CosmosTime.OffsetTime - osexpert/CosmosTime GitHub Wiki

OffsetTime Struct

Store utc + offset

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

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

Constructors
OffsetTime(UtcTime, TimeSpan) offsetMinutes: utc+offsetMinutes=local
OffsetTime(int, int, int, int, int, int, int, TimeSpan) year, month, day, etc. in Clock time
OffsetTime(int, int, int, int, int, int, int, TimeZoneInfo) year, month, day, etc. in Clock time
Will pick the offset from the tz
OffsetTime(int, int, int, int, int, int, TimeSpan) year, month, day, etc. in Clock time
OffsetTime(int, int, int, int, int, int, TimeZoneInfo) year, month, day, etc. in Clock time
Will pick the offset from the tz
OffsetTime(int, int, int, TimeSpan) year, month, day, etc. in Clock time
OffsetTime(int, int, int, TimeZoneInfo) year, month, day, etc. in Clock time
Will pick the offset from the tz
OffsetTime(long, TimeSpan) ticks in Clock time
Fields
MaxValue TODO
MinValue TODO
Properties
ClockDateTime UtcTime + Offset = Clock Time
Unspecified Kind.
Date clock time's Date
LocalNow Will capture Utc time + local offset to utc
It make little sense to call this on a server, it will capture the server offset to utc, and that make little sense.
Same as Now(TimeZoneInfo.Local)
Offset Offset from Utc
Ticks Ticks in clock time
If you need Tick in Utc, use UtcTime.Ticks
TimeOfDay clock time's TimeOfDay
UtcDateTime Utc Kind
UtcNow An UtcOffsetTime with utc time without offset (no time zone info)
Same as Now(TimeZoneInfo.Utc)
UtcTime TODO
Methods
Add(TimeSpan)
AddTicks(long) Add ticks
CompareTo(OffsetTime) TODO
Equals(OffsetTime) Equal if the Utc time is equal.
So there can be two OffsetTime's with same Utc time but different Offsets, and they will be equal.
Equals(object) Indicates whether this instance and a specified object are equal.
EqualsExact(OffsetTime) Also check that offset is the same
FromLocalDateTime(DateTime, TimeSpan) TODO
FromUnspecifiedDateTime(DateTime, TimeSpan) TODO
FromUtcDateTime(DateTime, TimeSpan) TODO
GetHashCode() Returns the hash code for this instance.
Now(TimeZoneInfo) Get Now in a zone (time will always be utc, but the offset captured will depend on the tz)
Parse(string) Parse ISO formats:
{time}Z
{time}+
ParseCosmosDb(string, TimeSpan) Parse fixed length utc (28 chars, ends with Z)
ToDateTimeOffset() Returns DateTimeOffset...
ToString() Iso format.
{local}+
TryParse(string, OffsetTime) Parse ISO formats:
"{time}Z"
"{time}{offset}"
TryParse(string, OffsetTime, Func<DateTimeOffset,TimeSpan>) Parse ISO formats:
"{time}Z"
"{time}{offset}"
"{time}" (tzIfUnspecified will be called)
Operators
operator +(OffsetTime, TimeSpan) TODO
operator ==(OffsetTime, OffsetTime) TODO
operator >(OffsetTime, OffsetTime) TODO
operator >=(OffsetTime, OffsetTime) TODO
operator !=(OffsetTime, OffsetTime) TODO
operator <(OffsetTime, OffsetTime) TODO
operator <=(OffsetTime, OffsetTime) TODO
operator -(OffsetTime, OffsetTime) TODO
operator -(OffsetTime, TimeSpan) TODO
⚠️ **GitHub.com Fallback** ⚠️