C# Class InTheHand.DateTimeOffsetHelper

Helper class for DateTimeOffset.
PlatformVersion supported AndroidAndroid 4.4 and later iOSiOS 9.0 and later macOSOS X 10.7 and later Windows UWPWindows 10 Windows StoreWindows 8.1 or later Windows Phone StoreWindows Phone 8.1 or later Windows Phone SilverlightWindows Phone 8.0 or later Windows (Desktop Apps)Windows Vista or later
Datei anzeigen Open project: inthehand/Charming

Public Methods

Method Description
FromNSDate ( NSDate date ) : DateTimeOffset
FromUnixTimeMilliseconds ( long milliseconds ) : DateTimeOffset

Converts a Unix time expressed as the number of milliseconds that have elapsed since 1970-01-01T00:00:00Z to a DateTimeOffset value.

FromUnixTimeSeconds ( long seconds ) : DateTimeOffset

Converts a Unix time expressed as the number of seconds that have elapsed since 1970-01-01T00:00:00Z to a DateTimeOffset value.

ToNSDate ( this value ) : NSDate
ToUnixTimeMilliseconds ( this date ) : long

Returns the number of milliseconds that have elapsed since 1970-01-01T00:00:00.000Z.

Unix time represents the number of seconds that have elapsed since 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC). It does not take leap seconds into account. This method returns the number of milliseconds in Unix time.

This method first converts the current instance to UTC before returning the number of milliseconds in its Unix time. For date and time values before 1970-01-01T00:00:00Z, this method returns a negative value.

ToUnixTimeSeconds ( this date ) : long

Returns the number of seconds that have elapsed since 1970-01-01T00:00:00Z.

Unix time represents the number of seconds that have elapsed since 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC). It does not take leap seconds into account.

This method first converts the current instance to UTC before returning its Unix time. For date and time values before 1970-01-01T00:00:00Z, this method returns a negative value.

Method Details

FromNSDate() public static method

public static FromNSDate ( NSDate date ) : DateTimeOffset
date NSDate
return DateTimeOffset

FromUnixTimeMilliseconds() public static method

Converts a Unix time expressed as the number of milliseconds that have elapsed since 1970-01-01T00:00:00Z to a DateTimeOffset value.
public static FromUnixTimeMilliseconds ( long milliseconds ) : DateTimeOffset
milliseconds long A Unix time, expressed as the number of milliseconds that have elapsed since 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC). /// For Unix times before this date, its value is negative.
return DateTimeOffset

FromUnixTimeSeconds() public static method

Converts a Unix time expressed as the number of seconds that have elapsed since 1970-01-01T00:00:00Z to a DateTimeOffset value.
public static FromUnixTimeSeconds ( long seconds ) : DateTimeOffset
seconds long A Unix time, expressed as the number of seconds that have elapsed since 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC). /// For Unix times before this date, its value is negative.
return DateTimeOffset

ToNSDate() public static method

public static ToNSDate ( this value ) : NSDate
value this
return NSDate

ToUnixTimeMilliseconds() public static method

Returns the number of milliseconds that have elapsed since 1970-01-01T00:00:00.000Z.
Unix time represents the number of seconds that have elapsed since 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC). It does not take leap seconds into account. This method returns the number of milliseconds in Unix time.

This method first converts the current instance to UTC before returning the number of milliseconds in its Unix time. For date and time values before 1970-01-01T00:00:00Z, this method returns a negative value.

public static ToUnixTimeMilliseconds ( this date ) : long
date this The DateTimeOffset value.
return long

ToUnixTimeSeconds() public static method

Returns the number of seconds that have elapsed since 1970-01-01T00:00:00Z.
Unix time represents the number of seconds that have elapsed since 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC). It does not take leap seconds into account.

This method first converts the current instance to UTC before returning its Unix time. For date and time values before 1970-01-01T00:00:00Z, this method returns a negative value.

public static ToUnixTimeSeconds ( this date ) : long
date this The DateTimeOffset value.
return long