'********************************************************************
'*
'* Function DateToInteger8
'*
'* Author: NetworkAdminKB.com
'* Created: 2006-01-13
'* Modified: 2006-01-13
'*
'* Purpose: Returns a string representation of the Integer8 value for
'* the given date.
'*
'* Input:
'* dmtDateValue A string or Date value in the format
'* 1/10/2006 7:45:41 PM
'* anyTZAdjust A boolean indicating to adjust for the local computer
'* Time Zone setting OR a number representing the desired
'* Time Zone setting adjustment to use, expressed in seconds.
'* True = Adjust for Time Zone (Default)
'* False = Do not adjust for Time Zone
'* Example Time Zone Adjustment Values (not a complete list)
'* 120 = GMT - 2 hours
'* 60 = GMT - 1 hour
'* 0 = GMT
'* -60 = GMT + 1 hour
'* -120 = GMT + 2 hours
'* If Empty is passed then the Default Computer Local Time Zone
'* information is used.
'*
'* Output: Returns a string representation of the Integer8 value for
'* the given date.
'*
'* Notes: The Integer8 value is the number of 100-nanosecond intervals
'* since 12:00 AM January 1, 1601, in Coordinated Universal
'* Time (UTC). The conversion is only accurate to the nearest
'* second, so the Integer8 value will always end in at least
'* seven zeros.
'*
'* Calls:
'* DateTimeBias
'*
'********************************************************************
Function DateToInteger8(ByVal dtmDateValue, ByVal anyTZAdjust)
'Version: 1.0 2006-01-13
Dim lngAdjust, dtmAdjusted, lngSeconds
Dim strInteger8
If Vartype(anyTZAdjust) <> 11 Then
lngAdjust = anyTZAdjust
Else
lngAdjust = DateTimeBias
'Set default if not specified.
If IsEmpty(anyTZAdjust) Then anyTZAdjust=True
'If anyTZAdjust=False Then don't adjust for TZ.
If Not anyTZAdjust Then lngAdjust=0
End If 'IsNumeric(anyTZAdjust)
'Set default if not specified.
If IsEmpty(anyTZAdjust) Then anyTZAdjust=True
'If anyTZAdjust=False Then don't adjust for TZ.
If Not anyTZAdjust Then lngAdjust=0
'Convert datetime value to UTC.
dtmAdjusted = DateAdd("n", lngAdjust, dtmDateValue)
'Find number of seconds since 1/1/1601.
lngSeconds = DateDiff("s", #1/1/1601#, dtmAdjusted)
'Convert the number of seconds to a string
'and convert to 100-nanosecond intervals.
DateToInteger8 = CStr(lngSeconds) & "0000000"
End Function 'DateToInteger8