C# Class Com.Aurora.Shared.Helpers.DateTimeHelper

Show file Open project: aurora-lzzp/Aurora-Weather

Public Methods

Method Description
GetTimeZone ( System.DateTime loc, System.DateTime utc ) : TimeZoneInfo

指定当地时间和其对应的 utc 时间, 得到这个地方的时区(只能精确到时区) +5: 即东五区 -3: 即西三区

ReviseLoc ( System.DateTime dateTime, System.TimeSpan UtcOffset ) : System.DateTime
ReviseLoc ( System.TimeSpan UtcOffset ) : System.DateTime
ReviseLoc ( TimeZoneInfo timeZone ) : System.DateTime

根据当前时间,以及指定的时区,返回当地时间

ReviseLoc ( TimeZoneInfo timeZone, System.DateTime dateTime ) : System.DateTime

Method Details

GetTimeZone() public static method

指定当地时间和其对应的 utc 时间, 得到这个地方的时区(只能精确到时区) +5: 即东五区 -3: 即西三区
public static GetTimeZone ( System.DateTime loc, System.DateTime utc ) : TimeZoneInfo
loc System.DateTime
utc System.DateTime
return System.TimeZoneInfo

ReviseLoc() public static method

public static ReviseLoc ( System.DateTime dateTime, System.TimeSpan UtcOffset ) : System.DateTime
dateTime System.DateTime
UtcOffset System.TimeSpan
return System.DateTime

ReviseLoc() public static method

public static ReviseLoc ( System.TimeSpan UtcOffset ) : System.DateTime
UtcOffset System.TimeSpan
return System.DateTime

ReviseLoc() public static method

根据当前时间,以及指定的时区,返回当地时间
public static ReviseLoc ( TimeZoneInfo timeZone ) : System.DateTime
timeZone System.TimeZoneInfo
return System.DateTime

ReviseLoc() public static method

public static ReviseLoc ( TimeZoneInfo timeZone, System.DateTime dateTime ) : System.DateTime
timeZone System.TimeZoneInfo
dateTime System.DateTime
return System.DateTime