asp.net实现UNIX 时间戳
//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);
asp.net实现UNIX 时间戳的更多相关文章
- js时间格式化函数,支持Unix时间戳
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...
- Asp.Net Unix时间戳和DateTime类型转换
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System. ...
- js 取得 Unix时间戳(Unix timestamp)
js 取得 Unix时间戳 Unix时间戳(Unix timestamp),或称Unix时间(Unix time).POSIX时间(POSIX time),是一种时间表示方式,定义为从格林威治时间19 ...
- 时间:UTC时间、GMT时间、本地时间、Unix时间戳
转自:http://blog.csdn.net/u012102306/article/details/51538574 1.UTC时间 与 GMT时间 我们可以认为格林威治时间就是时间协调时间(GMT ...
- 简述unix时间戳
unix时间戳是从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数,不考虑闰秒. Unix时间戳(英文为Unix epoch, Unix time, POSIX time 或 Unix ti ...
- 如何在不同编程语言中获取现在的Unix时间戳(Unix timestamp)
Java time JavaScript Math.round(new Date().getTime()/1000)getTime()返回数值的单位是毫秒 Microsoft .NET / C# ep ...
- Unix时间戳(Unix timestamp)转换工具
http://tool.chinaz.com/Tools/unixtime.aspx 现在的Unix时间戳(Unix timestamp)是 1440732364 Unix时间戳( ...
- 如何在不同编程语言中获取现在的Unix时间戳(Unix timestamp)?
Java time JavaScript Math.round(new Date().getTime()/1000) 之所以除以1000是因为getTime()返回数值的单位是毫秒 Microsoft ...
- 不同语言的Unix时间戳
如何在不同编程语言中获取现在的Unix时间戳(Unix timestamp)? Java time JavaScript Math.round(new Date().getTime()/1000)ge ...
随机推荐
- STL源代码剖析 读书总结
<<STL源代码剖析>> 侯捷著 非常早就买了这本书, 一直没看, 如今在实验室师兄代码的时候发现里面使用了大量泛型编程的内容, 让我有了先看看这本书的想法. 看之前我对于泛型 ...
- linux下php扩展curl的安装
方法一 安装cURL wget http://curl.haxx.se/download/curl-7.17.1.tar.gz tar -zxf curl-7.17.1.tar.gz ./config ...
- C++ 实现Trim
一.字符串去空格(没有处理字符串中间的空格) lTrim:除去字符串开头的空格 eg." abc123 " --> "abc123 " ...
- DataSet、DataTable、DataRow区别
DataSet 表示数据在内存中的缓存. 属性 Tables 获取包含在 DataSet 中的表的集合. ds.Tables["sjxx"] DataTable 表示内存中数据 ...
- 将json格式日期(毫秒数)转成日常日期格式和日常格式时间对比
第一:是把生成的Json格式的时间转换,注意要看清楚时间的格式 function (cellval) { var date = new Date(parseInt(cellval.replace(&q ...
- BAK文件怎么恢复到数据库中
1.右击SQLServer2000实例下的“数据库”文件夹.就是master等数据库上一级的那个图标.选择“所有任务”,“还原数据库” 2.在“还原为数据库”中填上你希望恢复的数据库名字.这个名字应该 ...
- iOS框架介绍
iOS框架介绍 Cocoa Touch GameKit 实现对游戏中心的支持,让用户能够在线共享他们的游戏相关的信息 iOS设备之间蓝牙数据传输 从iOS7开始过期 局域网游 ...
- [Linked List]Reorder List
otal Accepted: 54991 Total Submissions: 252600 Difficulty: Medium Given a singly linked list L: L0→L ...
- 菜鸟的jQuery源码学习笔记(二)
jQuery对象是使用构造函数和原型模式相结合的方式创建的.现在来看看jQuery的原型对象jQuery.prototype: jQuery.fn = jQuery.prototype = { //成 ...
- Interaction with the camera or the photo library
As we said before, we need a delegate to deal with the user interaction with the camera or the photo ...