Class DateTimeConvertor
- Namespace
- Assembly
- Facebook.dll
Utilities to convert dates to and from unix time.
public static class DateTimeConvertor
- Inheritance
-
DateTimeConvertor
- Inherited Members
Properties
Epoch
Gets the epoch time.
public static DateTime Epoch { get; }
Property Value
- DateTime
The epoch time.
Methods
FromIso8601FormattedDateTime(string)
Converts ISO-8601 format (yyyy-MM-ddTHH:mm:ssZ) date time to DateTime.
public static DateTime FromIso8601FormattedDateTime(string iso8601DateTime)
Parameters
iso8601DateTime
stringThe ISO-8601 formatted date time.
Returns
FromUnixTime(double)
Converts a unix time string to a DateTime object.
public static DateTime FromUnixTime(double unixTime)
Parameters
unixTime
doubleThe unix time.
Returns
- DateTime
The DateTime object.
FromUnixTime(string)
Converts a unix time string to a DateTime object.
public static DateTime FromUnixTime(string unixTime)
Parameters
unixTime
stringThe string representation of the unix time.
Returns
- DateTime
The DateTime object.
ToIso8601FormattedDateTime(DateTime)
Converts to specified DateTime to ISO-8601 format (yyyy-MM-ddTHH:mm:ssZ).
public static string ToIso8601FormattedDateTime(DateTime dateTime)
Parameters
dateTime
DateTimeThe date time.
Returns
- string
Returns the string representation of date time in ISO-8601 format (yyyy-MM-ddTHH:mm:ssZ).
ToUnixTime(DateTime)
Converts a DateTime object to unix time.
public static double ToUnixTime(DateTime dateTime)
Parameters
dateTime
DateTimeThe date time.
Returns
- double
The unix date time.
ToUnixTime(DateTimeOffset)
Converts a DateTimeOffset object to unix time.
public static double ToUnixTime(DateTimeOffset dateTime)
Parameters
dateTime
DateTimeOffsetThe date time.
Returns
- double
The unix date time.