[转载]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 { /// < ...
随机推荐
- VisualStudioCode中用dotnet命令创建多个ASP.NET Core 项目、类库、控制台程序,并添加应用间的引用
一.准备工作 首先安装VisualStudioCode并且可以使用. 1.首先新创建空的MyApps文件夹,作为项目主目录,下面将在这个文件夹中创建多个web应用程序.类型.控制台程序等. 2.打开V ...
- opencart3属性attribute实现换行等简单html代码
opencart3属性attribute在前台页面默认是没有解析html代码功能的,比如想实现换行,后台这样写:line 1<br>line 2,但前台产品页也是line 1<br& ...
- java.lang.IllegalStateException: Connection pool shut down
最近使用HttpClient 4.5 使用 CloseableHttpClient 发起连接后,使用CloseableHttpResponse 接受返回结果,结果就报错了,上网查了下,有位stacko ...
- 增长中的时间序列存储(Scaling Time Series Data Storage) - Part I
本文摘译自 Netflix TechBlog : Scaling Time Series Data Storage - Part I 重点:扩容.缓存.冷热分区.分块. 时序数据 - 会员观看历史 N ...
- libcurl.a 跨平台
编译成libxxx.a文件后, 通过lipo把多个不同架构的文件合并起来成为一个文件 在build setting 设置 head search path , library search path ...
- Linux学习路线全解,Linux操作系统学习路线
大家都知道,在现在这个信息化飞速发展的时代,IT技术火速发展,信息的重要性,可想而知.现在,在北京当一个高级运维工程师,年薪百万已经不是梦想.当然我也想,谁不想挣大钱,开好车,住好房.下面说说自己的一 ...
- Android 崩溃优化
Android 两种崩溃 android崩溃分为Java崩溃和Nativie崩溃 java崩溃就是java代码中,出现未捕获的异常,导致程序异常退出 Native崩溃一般是因为在Native代码中访问 ...
- VS 2017 激活码
最近逐渐抛弃了 VS2015 更新迭代到2017版本安装流程不必说激活码双手奉上 Enterprise: NJVYC-BMHX2-G77MM-4XJMR-6Q8QF Professional: KB ...
- 搭建apache本地服务器·Win
1.下载apache地址:https://www.apachelounge.com/download/ 注意:下载压缩包如下 httpd-2.4.37-win64-VC15.zip 其中根据自己电脑的 ...
- PAT (Basic Level) Practice (中文)1023 组个最小数
1023 组个最小数 给定数字 0-9 各若干个.你可以以任意顺序排列这些数字,但必须全部使用.目标是使得最后得到的数尽可能小(注意 0 不能做首位).例如:给定两个 0,两个 1,三个 5,一个 8 ...