设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 4340|回复: 7
打印 上一主题 下一主题

[ADO/DAO] 【源码】Fans.net的函数:Mysql数据中的时间戳转换为Access标准时间-FROM_UNIXTIME

[复制链接]
1#
发表于 2015-4-13 11:15:16 | 显示全部楼层
  1. ''' <sumary>
  2.     ''' 把时间戳转换为标准时间
  3.     ''' </sumary>
  4.     ''' <param name="time">要转换的UNIX时间戳</param>
  5.     ''' <param name="timeZone">该时间戳对应的时区</param>
  6.     Public Shared Function FromUnixTime(time As Double, timeZone As Integer) As DateTime
  7.         Dim dtmStart As DateTime = New DateTime(1970, 1, 1, 0, 0, 0)
  8.         Dim t As DateTime = DateAdd(DateInterval.Second, CDbl(time), dtmStart)
  9.         Return DateAdd(DateInterval.Hour, timeZone, t)
  10.     End Function
复制代码
VB.NET
2#
发表于 2015-4-13 17:40:46 | 显示全部楼层
admin 发表于 2015-4-13 11:33
vb.net 好像更精简些

是的,语法上比VB更精简。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-22 20:49 , Processed in 0.089549 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表