DateTime转换为timeStamp:
DateTime dt = DateTime.Now; DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); TimeSpan timeSpan = dt.Subtract(startTime); string timeStamp = timeSpan.Ticks.ToString(); return timeStamp.Substring(0, timeStamp.Length - 7);timeStamp转换为DateTime: string timeStamp = "1144821796"; DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970,1,1)); long lTime = long.Parse(timeStamp + "0000000"); TimeSpan toNow = new TimeSpan(lTime); DateTime dtResult = dtStart.Add(toNow);