MSAccess - 时间戳 - 世界时间? [英] MSAccess - Timestamp - Universal Time?
问题描述
我有一个 Access 应用程序,它在美国和印度时区共享并在本地运行.我需要可靠地时间戳记录更改.用户 1 和用户 2 可能正在接触时钟两侧的同一数据集中的记录.
I have an Access app that is shared across and run locally in US and India timezones. I need to reliably timestamp record changes. User1 and User2 may be touching records in the same dataset on opposite sides of the clock.
用户将根据每个定期 SYNC 发送的时间戳从 SQL 服务器推/拉带时间戳的记录.我做了一个初步的函数,它只是简单地获取 Now() 值作为时间戳,但我可以看到这将是生产中的一个问题.
Users will push/pull the timestamped records from SQL server based on Timestamp that gets sent with each periodic SYNC. I made a preliminary function that simply grabbed the Now() value as the timestamp, but I can see how that will be an issue in production.
有什么建议可以处理这个时间戳吗?
Any suggestions to handle this timestamp thing?
推荐答案
试试这个
Option Compare Database
Option Explicit
Private Declare Function GetTimeZoneInformation Lib "kernel32" (lpTimeZoneInformation As TimeZoneInfo) As Long
Private Type SystemTime
intYear As Integer
intMonth As Integer
intwDayOfWeek As Integer
intDay As Integer
intHour As Integer
intMinute As Integer
intSecond As Integer
intMilliseconds As Integer
End Type
Private Type TimeZoneInfo
lngBias As Long
intStandardName(32) As Integer
intStandardDate As SystemTime
intStandardBias As Long
intDaylightName(32) As Integer
intDaylightDate As SystemTime
intDaylightBias As Long
End Type
Public Function GetUTCOffset() As Date
Dim lngRet As Long
Dim udtTZI As TimeZoneInfo
lngRet = GetTimeZoneInformation(udtTZI)
GetUTCOffset = udtTZI.lngBias / 60 / 24
End Function
我在这里找到的:
http://www.dbforums.com/microsoft-access/1000377-now-users-using-different-time-zones.html
这篇关于MSAccess - 时间戳 - 世界时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!