//DateTime转换为时间戳
public long GetTimeSpan(DateTime time) { DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970,1,1,0,0,0,0));
return (long)(time - startTime).TotalSeconds; }
//timeSpan转换为DateTime
public DateTime TimeSpanToDateTime(long span)
{
DateTime time = DateTime.MinValue;
DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970,1,1,0,0,0,0));
time=startTime.AddSeconds(span);
return time;
}