Class DateTimeUtils
Inheritance
object
DateTimeUtils
Namespace: Xrpl.Utils
Assembly: Xrpl.dll
Syntax
public static class DateTimeUtils
Fields
|
Edit this page
View Source
RippleEpoch
The Ripple epoch, 2000-01-01T00:00:00Z: ledger time counts seconds from here.
Declaration
public static readonly DateTimeOffset RippleEpoch
Field Value
| Type |
Description |
| DateTimeOffset |
|
|
Edit this page
View Source
RippleEpochUnixSeconds
Unix seconds of the Ripple epoch, 2000-01-01T00:00:00Z.
Declaration
public const long RippleEpochUnixSeconds = 946684800
Field Value
Methods
|
Edit this page
View Source
FromRippleTime(long)
The UTC instant of a ledger time: RippleEpoch plus rippleTime seconds.
Declaration
public static DateTimeOffset FromRippleTime(long rippleTime)
Parameters
| Type |
Name |
Description |
| long |
rippleTime |
|
Returns
| Type |
Description |
| DateTimeOffset |
|
Exceptions
| Type |
Condition |
| ArgumentOutOfRangeException |
The result is outside the System.DateTimeOffset range.
|
|
Edit this page
View Source
ISOTimeToRippleTime(DateTime)
Ripple-epoch seconds of date.
Declaration
public static long ISOTimeToRippleTime(DateTime date)
Parameters
| Type |
Name |
Description |
| DateTime |
date |
A System.DateTimeKind.Local value is converted to UTC first;
an System.DateTimeKind.Unspecified one is taken as UTC.
|
Returns
|
Edit this page
View Source
ISOTimeToRippleTime(string)
Declaration
public static long ISOTimeToRippleTime(string iso8601)
Parameters
| Type |
Name |
Description |
| string |
iso8601 |
|
Returns
|
Edit this page
View Source
RippleTimeToISOTime(long)
Declaration
public static string RippleTimeToISOTime(long rippleTime)
Parameters
| Type |
Name |
Description |
| long |
rippleTime |
|
Returns
|
Edit this page
View Source
RippleTimeToUnixTime(long)
Declaration
public static long RippleTimeToUnixTime(long rpepoch)
Parameters
| Type |
Name |
Description |
| long |
rpepoch |
|
Returns
|
Edit this page
View Source
ToRippleTime(DateTime)
Ledger (Ripple-epoch) time of time: whole seconds since 2000-01-01T00:00:00Z,
rounded down. A time before the epoch gives 0 and one past uint.MaxValue seconds
(year 2136) gives uint.MaxValue, the range of an Expiration or
CloseTime field.
Declaration
public static uint ToRippleTime(DateTime time)
Parameters
| Type |
Name |
Description |
| DateTime |
time |
A System.DateTimeKind.Local value is converted to UTC first;
an System.DateTimeKind.Unspecified one is taken as UTC.
|
Returns
|
Edit this page
View Source
ToRippleTime(DateTimeOffset)
Ledger (Ripple-epoch) time of time: whole seconds since 2000-01-01T00:00:00Z,
rounded down. A time before the epoch gives 0 and one past uint.MaxValue seconds
(year 2136) gives uint.MaxValue, the range of an Expiration or
CloseTime field.
Declaration
public static uint ToRippleTime(DateTimeOffset time)
Parameters
| Type |
Name |
Description |
| DateTimeOffset |
time |
|
Returns
|
Edit this page
View Source
UnixTimeToRippleTime(long)
Ripple-epoch seconds of a Unix time in milliseconds, rounded to the nearest second, ties to
even (System.Math.Round(decimal): 0.5 s is 0, 2.5 s is 2; xrpl.js rounds ties up). For an expiration or any deadline use ToRippleTime(DateTimeOffset), which
rounds down: rounding 0.7 s up would put the deadline a second later than the instant asked for.
Declaration
public static long UnixTimeToRippleTime(long timestamp)
Parameters
| Type |
Name |
Description |
| long |
timestamp |
|
Returns