Quantcast
Viewing all articles
Browse latest Browse all 5

Link Table Default Value

You can return the current Coordinated Universal Time value by calling the Windows API GetSystemTime function using the following module.  

' basUTC module
' returns current date/time as UTC (Coordinated Universal Time)
' by calling GetUTC() function

Option Compare Database
Option Explicit

Type SYSTEMTIME
  wYear As Integer
  wMonth As Integer
  wDayOfWeek As Integer
  wDay As Integer
  wHour As Integer
  wMinute As Integer
  wSecond As Integer
  wMilliseconds As Integer
End Type

Declare Sub GetSystemTime Lib "kernel32.dll" (lpSystemTime As SYSTEMTIME)

Public Function GetUTC() As Date

    Dim utctime As SYSTEMTIME
    
    GetSystemTime utctime  ' put the time and date in UTC time into utctime
    With utctime
        GetUTC = DateSerial(.wYear, .wMonth, .wDay) + TimeSerial(.wHour, .wMinute, .wSecond)
    End With
    
End Function

By storing the UTC value (the return value of the GetUTC  function) as the transaction date/time it is isolated from regional variations.

Ken Sheridan, Stafford, England


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>