这里直接上代码

懂C# 的程序猿 一看便知道如何使用的...

 /// <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(, , ));
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(,,,,,,));
//intResult = (time- startTime).TotalMilliseconds;
long t = (time.Ticks - startTime.Ticks)/; //除10000调整为13位
return t;
}

本文转自:http://yfnk.net/a/wenzhangzhongxin/2013/0415/22.html

C# 时间与时间戳互转 13位|13位時間戳与日期换转的更多相关文章

  1. c#时间与时间戳互转13位

    Unix时间戳(Unix timestamp),或称Unix时间(Unix time).POSIX时间(POSIX time),是一种时间表示方式,定义为从格林威治时间1970年01月01日00时00 ...

  2. scala时间和时间戳互转

    时间转换为时间戳: import java.text.SimpleDateFormat object test { def main(args: Array[String]): Unit = { va ...

  3. C# 时间与时间戳互转 13位

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

  4. C# 时间与时间戳互转

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

  5. Shell日期时间和时间戳的转换

    Gitlab的备份文件是以时间戳显示的,类似:1438624820_gitlab_backup.tar 为了更易于阅读,想把文件名转换成日期格式:2015-08-04_gitlab_backup.ta ...

  6. mysql时间操作(时间差和时间戳和时间字符串的互转)

    mysql时间操作(时间差和时间戳和时间字符串的互转) 两个时间差: MySQL datediff(date1,date2):两个日期相减 date1 - date2,返回天数. select dat ...

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

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

  8. Mysql 时间、字符串、时间戳互转

    时间转字符串 select date_format(now(),'%Y-%m-%d'); 时间转时间戳 select UNIX_TIMESTAMP(now()); 时间戳转时间 ) :: 时间戳转字符 ...

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

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

随机推荐

  1. Predicate Programming Guide

    https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/AdditionalChap ...

  2. Python中Numpy mat的使用

    前面介绍过用dnarray来模拟,但mat更符合矩阵,这里的mat与Matlab中的很相似.(mat与matrix等同) 基本操作 >>> m= np.mat([1,2,3]) #创 ...

  3. 徒手教你使用zookeeper编写服务发现

    zookeeper是一个强一致[不严格]的分布式数据库,由多个节点共同组成一个分布式集群,挂掉任意一个节点,数据库仍然可以正常工作,客户端无感知故障切换.客户端向任意一个节点写入数据,其它节点可以立即 ...

  4. How to restrict root user to access or modify a file and directory in Linux

    Now in this article I will show you steps to prevent or restrict access of root user to access certa ...

  5. k8s调度的预选策略及优选函数

    scheduler调度过程:    Predicate(预选)-->Priority(优选)-->Select(选定)调度方式:    1.节点亲和性调度(NodeAffinity)使用n ...

  6. linux三剑客正则表达式

    ^:以...开头,^d,意思是以d开头.例如:ls  -F(-p) | grep " ^d " $:以...结尾,/$,意思是以/结尾.例如:ls -F(-p) | grep &q ...

  7. 基于Centos7.2使用Cobbler工具定制化批量安装Centos7.2系统

    1.1    定制Centos_7_x86_64.ks文件内容 # Cobbler for Kickstart Configurator for CentOS 7.2.1511 by Wolf_Dre ...

  8. 如何用 CSS 和 D3 创作一个无尽的六边形空间

    效果预览 按下右侧的"点击预览"按钮可以在当前页面预览,点击链接可以全屏预览. https://codepen.io/comehope/pen/NBvrWL 可交互视频 此视频是可 ...

  9. 【nginx】 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream

    2013/10/22 20:05:49 [error] 12691#0: *6 FastCGI sent in stderr: "Primary script unknown" w ...

  10. redis列表,字典,管道,vue安装,创建项目

    redis mysql,redis,mogondb 1.mysql,oracle:关系型数据库,有表概念 2.redis,mongodb/nosql:非关系型数据库 没有表概念 mongodb存储在硬 ...