C# Class NContrib.Extensions.DateTimeExtensions

Datei anzeigen Open project: veracross/ncontrib

Public Properties

Property Type Description
UnixEpoch System.DateTime

Public Methods

Method Description
ToBeatTime ( this dt ) : double

Converts a timestamp to Swatch Internet Time (beat time)

ToDateTime ( this unixTimestamp ) : System.DateTime

Converts a UNIX timestamp to a DateTime object

ToTimeZone ( this dt, string timeZoneId ) : System.DateTime

Converts a UTC DateTime to a DateTime in the specified timeZoneId

Use TimeZoneInfo.GetSystemTimeZones() to view available TimeZoneIds Or look in HKLM\Software\Microsoft\Windows NT\CurrentVersion\Time Zones\

ToTimeZone ( this dt, string fromTimeZoneId, string toTimeZoneId ) : System.DateTime

Converts a DateTime from one time zone to another

Use TimeZoneInfo.GetSystemTimeZones() to view available TimeZoneIds Or look in HKLM\Software\Microsoft\Windows NT\CurrentVersion\Time Zones\

ToUniversalTime ( this dt, string timeZoneId ) : System.DateTime

Converts an offset DateTime in the specified timeZoneId to a UTC DateTime

Use TimeZoneInfo.GetSystemTimeZones() to view available TimeZoneIds Or look in HKLM\Software\Microsoft\Windows NT\CurrentVersion\Time Zones\

ToUnixTime ( this dt ) : long

Converts the given DateTime to a UNIX timestamp

Method Details

ToBeatTime() public static method

Converts a timestamp to Swatch Internet Time (beat time)
public static ToBeatTime ( this dt ) : double
dt this
return double

ToDateTime() public static method

Converts a UNIX timestamp to a DateTime object
public static ToDateTime ( this unixTimestamp ) : System.DateTime
unixTimestamp this
return System.DateTime

ToTimeZone() public static method

Converts a UTC DateTime to a DateTime in the specified timeZoneId
Use TimeZoneInfo.GetSystemTimeZones() to view available TimeZoneIds Or look in HKLM\Software\Microsoft\Windows NT\CurrentVersion\Time Zones\
public static ToTimeZone ( this dt, string timeZoneId ) : System.DateTime
dt this
timeZoneId string Time zone to convert to
return System.DateTime

ToTimeZone() public static method

Converts a DateTime from one time zone to another
Use TimeZoneInfo.GetSystemTimeZones() to view available TimeZoneIds Or look in HKLM\Software\Microsoft\Windows NT\CurrentVersion\Time Zones\
public static ToTimeZone ( this dt, string fromTimeZoneId, string toTimeZoneId ) : System.DateTime
dt this
fromTimeZoneId string Time zone to convert from
toTimeZoneId string
return System.DateTime

ToUniversalTime() public static method

Converts an offset DateTime in the specified timeZoneId to a UTC DateTime
Use TimeZoneInfo.GetSystemTimeZones() to view available TimeZoneIds Or look in HKLM\Software\Microsoft\Windows NT\CurrentVersion\Time Zones\
public static ToUniversalTime ( this dt, string timeZoneId ) : System.DateTime
dt this
timeZoneId string Time zone to convert from
return System.DateTime

ToUnixTime() public static method

Converts the given DateTime to a UNIX timestamp
public static ToUnixTime ( this dt ) : long
dt this
return long

Property Details

UnixEpoch public_oe static_oe property

public static DateTime,System UnixEpoch
return System.DateTime