Class DateUtils
Helper class to convert dates from ISO strings to epoch timestamps and vice versa.
Inheritance
System.Object
DateUtils
Namespace: Casper.Network.SDK.Utils
Assembly: Casper.Network.SDK.dll
Syntax
public class DateUtils : object
Methods
ToEpochTime(DateTime)
Converts a DateTime object to epoch timestamp.
Declaration
public static ulong ToEpochTime(DateTime datetime)
Parameters
Type | Name | Description |
---|---|---|
DateTime | datetime |
Returns
Type | Description |
---|---|
System.UInt64 |
ToEpochTime(String)
Converts an ISO formatted date string to epoch timestamp.
Declaration
public static ulong ToEpochTime(string datetime)
Parameters
Type | Name | Description |
---|---|---|
System.String | datetime |
Returns
Type | Description |
---|---|
System.UInt64 |
ToISOString(UInt64)
Converts an epoc timestamp (in milliseconds) to an ISO formatted date string.
Declaration
public static string ToISOString(ulong epochTimeInMillis)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | epochTimeInMillis |
Returns
Type | Description |
---|---|
System.String |