1 将系统时间转换成UNIX时间戳
    DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970,1,1));
    DateTime dtNow = DateTime.Parse(DateTime.Now.ToString());
    TimeSpan toNow = dtNow.Subtract(dtStart);
    string timeStamp = toNow.Ticks.ToString();
    timeStamp = timeStamp.Substring(0,timeStamp.Length - 7);
    Response.Write(timeStamp);
   
    2 将UNIX时间戳转换成系统时间   
    string timeStamp = this.txtDate.Text;
    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);
    Response.Write(dtResult);

相关文章:

  • 2021-05-30
  • 2022-01-28
  • 2021-07-28
  • 2021-12-30
  • 2021-10-25
  • 2021-05-23
  • 2022-01-19
  • 2021-11-19
猜你喜欢
  • 2021-07-25
  • 2021-09-29
  • 2022-02-03
  • 2021-06-09
  • 2022-02-06
  • 2021-11-11
  • 2021-05-06
  • 2021-06-01
相关资源
相似解决方案