Table of Contents

Class DateTimeConvertor

Namespace
Facebook
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 string

The ISO-8601 formatted date time.

Returns

DateTime

Returns the DateTime equivalent to the ISO-8601 formatted date time.

FromUnixTime(double)

Converts a unix time string to a DateTime object.

public static DateTime FromUnixTime(double unixTime)

Parameters

unixTime double

The 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 string

The 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 DateTime

The 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 DateTime

The 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 DateTimeOffset

The date time.

Returns

double

The unix date time.