/// <summary>
        /// 将 DateTime时间格式转换为Unix时间戳格式
        /// </summary>
        /// <param name="time">时间</param>
        /// <returns>long</returns>
        public static long ConvertDateTimeToInt(DateTime time)
        {
            System.DateTime Time = TimeZone.CurrentTimeZone.ToLocalTime(, , , , , , ));
            ;   //除10000调整为13位
            return TimeStamp;
        }

        /// <summary>
        /// 将Unix时间戳格式 转换为DateTime时间格式
        /// </summary>
        /// <param name="time">时间</param>
        /// <returns>long</returns>
        public static DateTime ConvertDateTimeToInt(long time)
        {
            System.DateTime Time = TimeZone.CurrentTimeZone.ToLocalTime(, , , , , , ));
            DateTime dateTime = Time.AddMilliseconds(time);
            return dateTime;
        }

C#时间格式转换为时间戳互转的更多相关文章

  1. C# DateTime时间格式转换为Unix时间戳格式

    double ntime=dateTimeToUnixTimestamp(DateTime.Now); long g1 = GetUnixTimestamp(); long g2 = ConvertD ...

  2. DateTime时间格式转换为Unix时间戳格式

    /// <summary> /// 将DateTime时间格式转换为Unix时间戳格式 /// </summary> /// <param name="date ...

  3. JS时间格式和时间戳的互转

    //时间格式转为时间戳 function sjc(){ var date = new Date(); //时间对象 var str = date.getTime(); //转换成时间戳 } //时间戳 ...

  4. 用shell将时间字符串与时间戳互转

    date的详细用户可以参考下面的 http://www.cnblogs.com/xd502djj/archive/2010/12/29/1919478.html date 的具体用法可以查看另外一篇博 ...

  5. 关于javascript中时间格式和时间戳的转换

    当前时间获取的各种函数: var myDate = new Date();myDate.getYear();        //获取当前年份(2位),已经不推荐使用myDate.getFullYear ...

  6. Linux命令date日期时间和Unix时间戳互转

    A.将日期转换为Unix时间戳将当前时间以Unix时间戳表示: date +%s 输出如下: 1361542433 转换指定日期为Unix时间戳: date -d '2013-2-22 22:14' ...

  7. 微坑---微信小程序ios上时间字符串转换为时间戳时,在开发工具上和安卓手机上运行成功

    给定一个时间字符串  var time="2017-02-27 16:42:53" js有三种转换为时间戳的方法:1.var timestamp = Date.parse(time ...

  8. 微信小程序ios上时间字符串转换为时间戳时会报错,在开发工具上和安卓手机上运行成功

    给定一个时间字符串  var time="2017-02-27 16:42:53" js有三种转换为时间戳的方法: 1.var timestamp = Date.parse(tim ...

  9. JS时间格式和时间戳的相互转换

    时间戳转化为日期的方式 ; var newDate = new Date(); newDate.setTime(timestamp * ); // Mon May 28 2018 console.lo ...

随机推荐

  1. CQOI2018 简要题解

    破解D-H协议 列个式子会发现是BSGSBSGSBSGS的模板题,直接码就是了. 代码: #include<bits/stdc++.h> #include<tr1/unordered ...

  2. ABP框架系列之三十九:(NLayer-Architecture-多层架构)

    Introduction Layering of an application's codebase is a widely accepted technique to help reduce com ...

  3. Codeforces Round #536 (Div. 2) E dp + set

    https://codeforces.com/contest/1106/problem/E 题意 一共有k个红包,每个红包在\([s_i,t_i]\)时间可以领取,假如领取了第i个红包,那么在\(d_ ...

  4. MySQL之二 yum安装及初识

      安装   yum install mysql-server chkconfig -list mysqld 查看mysqld服务是否为开机启动 chkconfig mysqld on 设为开机启动 ...

  5. stm32手册上的英文

    crystal-less 无晶振 USB  FS(Full-speed)此外还有High-speed接口(简称HS),Low-speed接口(简称LS) frequency频率 CRC(Cyclic ...

  6. mac virtualbox 安装

    在Mac上装virtualbox提示安装失败!!! 安全性与隐私的通用下点击允许!!!

  7. 第三周Access的总结

    一.问;这节课你学到了什么知识? 答:这周我学得比较少,主要是学Access的数据库进行基本的维护. 2.3数据库的基本维护 对Access定期检查,修复是整个数据库重要部分: 1.Access可修复 ...

  8. Docker环境安装与配置

    Docker 简介 Docker使用Go语言编写的 安装Docker推荐LInux内核在3.10上 在2.6内核下运行较卡(CentOS 7.X以上内核是3.10) Docker 安装 安装yum-u ...

  9. 桌面管理工具 RedisDesktopManager 0.8.8

    RedisDesktopManager 0.8.8  发布,此版本更新内容如下: 改进: Show key bytes length and value bytes length #3677 修复: ...

  10. nginx并发模型与traffic_server并发模型简单比较

    ginx并发模型: nginx 的进程模型采用的是prefork方式,预先分配的worker子进程数量由配置文件指定,默认为1,不超过1024.master主进程创建监听套接口,fork子进程以后,由 ...