#region time, timestamp conversion /// <the Summary> /// convert the time stamp events /// </ the Summary> /// <param name = "dateTime"> </ param> /// <returns A> < / Returns> public static uint getTimestamp (the dateTime dateTime) { the dateTime DateStart = TimeZone.CurrentTimeZone.ToLocalTime ( new new the dateTime ( 1970 , . 1 , . 1 )); return Convert.ToUInt32 ((dateTime - DateStart) .TotalSeconds); } /// time timestamp format into C # /// </summary> /// <param name=”timeStamp”></param> /// <returns></returns> public static DateTime GetTimeFromUint(string timeStamp) { DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); long lTime = long.Parse(timeStamp + "0000000"); TimeSpan toNow = new TimeSpan(lTime); return dtStart.Add(toNow); } #endregion
Time and time stamp conversion
Guess you like
Origin www.cnblogs.com/yc1224/p/12022974.html
Recommended
Ranking