zoukankan      html  css  js  c++  java
  • C#取时间戳

    public DateTime GetTime(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); 

             } 

      

             // DateTime时间格式转换为Unix时间戳格式 

             public int ConvertDateTimeInt(System.DateTime time) 

             { 

                 System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); 

                 return (int)(time - startTime).TotalSeconds; 

             }

  • 相关阅读:
    node中fs模块
    node生成excel,动态替换表格内容
    Postgresql存放数组形式的数据
    ubuntu下安装typescript
    随笔6
    excel文件导出相应数据统计内容
    随笔4
    随笔3.2
    随笔2
    随笔1
  • 原文地址:https://www.cnblogs.com/itecho/p/1801367.html
Copyright © 2011-2022 走看看