/// <summary>
/// 将Unix时间戳转换为DateTime类型时间
/// </summary>
/// <param name="d">double 型数字</param>
/// <returns>DateTime</returns>
public static System.DateTime ConvertIntDateTime(double d)
{
System.DateTime time = System.DateTime.MinValue;
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
time = startTime.AddMilliseconds(d);
return time;
} /// <summary>
/// 将c# DateTime时间格式转换为Unix时间戳格式
/// </summary>
/// <param name="time">时间</param>
/// <returns>long</returns>
public static long ConvertDateTimeInt(System.DateTime time)
{
//double intResult = 0;
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970,1,1,0,0,0,0));
//intResult = (time- startTime).TotalMilliseconds;
long t = (time.Ticks - startTime.Ticks)/10000; //除10000调整为13位
return t;
}

最新文章

  1. zk textbox 更改字体大小及高度
  2. ExpressJs server中Router的设置
  3. lua class(table)
  4. Restfull API 示例
  5. (CodeForces 558C) CodeForces 558C
  6. 百度地图LBS应用开发代码
  7. WCF - Versus Web Service
  8. Java Dom解析xml
  9. 让EditPlus支持SQL高亮提示
  10. JAVA中JPA的主键自增长注解设置
  11. Axure RP初学2
  12. Spring MVC流程
  13. all-document
  14. PHP 对象转数组 Object转array
  15. linux-ubuntu 下R无法安装rjava模块的原因及解决方案
  16. 《Flask Web开发实战:入门、进阶与原理解析(李辉著 )》PDF+源代码
  17. SQL语句(十四)子查询
  18. 《剑指offer》第二十九题(顺时针打印矩阵)
  19. 在am中定义消息集束,并在CO中验证之后抛出异常。
  20. postman 获取时间戳的方法 和md5加密的方法

热门文章

  1. Laravel 加载第三方类库的方法
  2. Hive SQL NVL 相关函数
  3. c3p0数据库连接池 原创: Java之行 Java之行 5月8日 一、连接池概述 实际开发中“获得连接”或“释放资源”是非常消耗系统资源的两个过程
  4. android APP国际化一键切换实现
  5. 第二十章 无状态Web应用集成——《跟我学Shiro》
  6. git 创建标签推送远程分支
  7. 股票PE的应用
  8. 【数据库开发】在Windows上和Linux上配置MySQL的过程
  9. Android_7.1.1_r6源码编译
  10. eNSP——配置全局地址池的DHCP