[转载]vb 时间戳与时间互转
vb 时间戳与时间互转
在线测试时间戳与时间:http://tool.chinaz.com/Tools/unixtime.aspx
'参数:strTime:要转换的时间;intTimeZone:该时间对应的时区
'返回值:strTime相对于1970年1月1日午夜0点经过的秒数
'示例:ToUnixTime("2008-5-23 10:51:0", +8),返回值为1211511060
Function ToUnixTime(strTime, intTimeZone)
If IsEmpty(strTime) Or Not IsDate(strTime) Then strTime = Now
If IsEmpty(intTimeZone) Or Not IsNumeric(intTimeZone) Then intTimeZone = 0
ToUnixTime = DateAdd("h", -intTimeZone, strTime)
ToUnixTime = DateDiff("s", "1970-1-1 0:0:0", ToUnixTime)
End Function
'把UNIX时间戳转换为标准时间
'参数:intTime:要转换的UNIX时间戳;intTimeZone:该时间戳对应的时区
'返回值:intTime所代表的标准时间
'示例:FromUnixTime("1211511060", +8),返回值2008-5-23 10:51:0
Function FromUnixTime(intTime, intTimeZone)
If IsEmpty(intTime) Or Not IsNumeric(intTime) Then
FromUnixTime = Now()
Exit Function
End If
If IsEmpty(intTime) Or Not IsNumeric(intTimeZone) Then intTimeZone = 0
FromUnixTime = DateAdd("s", intTime, "1970-1-1 0:0:0")
FromUnixTime = DateAdd("h", intTimeZone, FromUnixTime)
End Function
---------------------
作者:boys1999
来源:CSDN
原文:https://blog.csdn.net/boys1999/article/details/23298415
版权声明:本文为博主原创文章,转载请附上博文链接!
[转载]vb 时间戳与时间互转的更多相关文章
- lua 时间戳和时间互转
1.时间戳转换成时间 local t = 1412753621000 function getTimeStamp(t) return os.date("%Y%m%d%H", ...
- Asp.Net时间戳与时间互转
/// <summary> /// 时间戳转成时间类型 /// </summary> /// <param name="timeStamp">& ...
- C#时间戳与时间互转
/// <summary> /// 时间戳转成时间类型 /// </summary> /// <param name="timeStamp">& ...
- js 时间戳转时间工具类 js时间戳与时间互转
/** * 时间戳格式化函数 * @param {string} format 格式 * @param {int} timestamp 要格式化的时间 默认为当前时间 * @return {strin ...
- python(6)时间戳和北京时间互转,输出当前的时间和推到七天前的日期
项目发展的需要:(包含时间函数)time datetime 时间戳和北京时间互转 import time import datetime s = '2015-04-17 11:25:30' d = d ...
- mysql时间操作(时间差和时间戳和时间字符串的互转)
mysql时间操作(时间差和时间戳和时间字符串的互转) 两个时间差: MySQL datediff(date1,date2):两个日期相减 date1 - date2,返回天数. select dat ...
- Java和JavaScript的时间互传
原创文章,转载请注明:Java和JavaScript的时间互传 By Lucio.Yang 1.从JavaScript到Java JavaScript: function query(){ var s ...
- jsp 自定义标签解决jsp页面中int时间戳的时间格式化问题
jsp 自定义标签解决jsp页面中int时间戳的时间格式化问题 之前在项目中根据需求,需要自定义标签,经过查询w3c文档,自己也踩了一些坑,特此记录自定义标签的步骤,下面就以我之前的一个例子中的定义一 ...
- 时间戳(Unix时间)
/// <summary> /// 时间戳与DateTime互转 /// </summary> public class UnixOfTimeHelper { /// < ...
随机推荐
- P1368 工艺 SA/最小表示法
正解:SA/最小表示法 解题报告: 传送门! 听说正解是最小表示法,,,O(n)然后常数还挺小的,,, 但是我不会QAQ! 所以先写下SA的做法趴,,,等get了最小表示法再来写正解QAQ 就这种题算 ...
- 讨论mui 的 mui.init 与 mui.plusReady
先来看一段代码 (function(m, doc) { mui.plusReady(function(){ var self = plus.webview.currentWebview(); olti ...
- centos7的systemd命令对比
centos7的systemd命令对比 http://www.linuxidc.com/Linux/2014-09/106490p2.htmhttp://www.linuxidc.com/Linux/ ...
- 24个 CSS 高级技巧合集
上期入口:史上最全实用网络爬虫合集! 1.使用CSS复位 CSS复位可以在不同的浏览器上保持一致的样式风格.您可以使用CSS reset 库Normalize等,也可以使用一个更简化的复位方法: ** ...
- How to Preloading content with rel preload
The preload value of the <link> element's rel attribute allows you to write declarative fetch ...
- VMware密匙
5A02H-AU243-TZJ49-GTC7K-3C61N 新版本密室:FF31K-AHZD1-H8ETZ-8WWEZ-WUUVA
- Fiddler使用总结(转载)
原文地址:https://www.cnblogs.com/yyhh/p/5140852.html 序章 Fiddler是一个蛮好用的抓包工具,可以将网络传输发送与接受的数据包进行截获.重发.编辑.转存 ...
- 基于C#的Appium自动化测试框架(Ⅰ):程序结构
因为工作原因,使用的编程语言都是C#,但是国内相应的Appium资料少得可怜,Java版本的Appium也考虑过,但是奈何自己搞不定Eclipse这个编译环境[说白了就是因为懒…… 无意中看到了外面的 ...
- 【转】Powershell与jenkins集成部署的运用(powershell运用)
powershell简介: 远程管理采用的一种新的通信协议,Web Services for Management,简称WS-MAN它通过http或者https进行工作,WS-WAN的实现主要基于一个 ...
- padding和margin
padding (内边距) 语法: (1)padding-left:10px; 左内边距 (2)padding-right:10px; 右内边距 (3)padding-top:10px; 上内边距 ( ...