UnixTime Struct
Definition
Namespace: DataStandardizer.Chronology
A point in time expressed as the number of seconds elapsed since the Unix epoch (1 January 1970 00:00:00 UTC), stored internally as a signed 64-bit integer.
public readonly struct UnixTime : ISystemTime
Remarks
Implicit conversions let a UnixTime be used interchangeably with a long. The SystemTimeExtensions, DateTimeExtensions, DateOnlyExtensions, and TimeOnlyExtensions classes provide conversions to and from the BCL date/time types.
Constructors
| Constructor | Notes |
|---|---|
UnixTime(long value) | Wraps a count of seconds since the Unix epoch. |
Properties
| Property | Signature | Notes |
|---|---|---|
JulianDayNumber | decimal JulianDayNumber { get; } | The instant as a Julian Day Number. |
Operators
| Operator | Signature | Notes |
|---|---|---|
| Implicit | implicit operator long(UnixTime) | Unwrap to the underlying long. |
| Implicit | implicit operator UnixTime(long) | Wrap a long. |
Extension methods
The following extensions apply to UnixTime:
ToDateTime<T>()— returnsDateTime.ToDateOnly<T>()— returnsDateOnly(net6.0+).ToTimeOnly<T>()— returnsTimeOnly(net6.0+).
Applies to
Targets netstandard1.0, netstandard2.0, net8.0, and net10.0.