close
.NET Framework 4.6.1加入的新lib
sample:
/// <summary> /// 把Unix Time轉為Datetime /// </summary> /// <param name="unixTime"></param> /// <returns></returns> public static DateTime ConvertUnixtimeToDatetime(String unixTime) { long lgUnixtime; DateTime dt=DateTime.Now; if(!String.IsNullOrEmpty(unixTime)) { try { lgUnixtime = Convert.ToInt64(unixTime); dt = DateTimeOffset.FromUnixTimeSeconds(lgUnixtime).ToLocalTime().DateTime; } catch (Exception ex) { //dt = DateTime.Now; } } return dt; }
全站熱搜
留言列表