By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

ADODB.Record - Fields("RESOURCE_LASTWRITETIME")

P: n/a
ADODB.Record - Fields("RESOURCE_LASTWRITETIME")

Can you confirm that this field returns a datetime as a GMT (UTC - zulu)
value?

I'm guessing I have to go to API to convert safely regardless of time zone
to which the computer is defaulted?

partial code is:

Const AppLocation As String = "http://some site and file"

Public Sub CheckAppCurrency()

Dim R As ADODB.Record
Dim S As Date
Dim L As Date

Set R = New ADODB.Record
R.Open "", _
"URL=" & AppLocation, , _
adOpenIfExists Or adCreateCollection
With R
S = R.Fields("RESOURCE_LASTWRITETIME").Value
.Close
End With

...

S seems to be GMT.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Lyle Fairfield <Mi************@Invalid.Com> wrote in
news:Xn*******************@130.133.1.4:
I'm guessing I have to go to API to convert safely regardless of time
zone to which the computer is defaulted?


Well, this was not so tough; I thought it would require a lot of
conversions from VBA datetimes to SystemTimes, but one can just use the
Time Zone Information Bias:

Option Compare Database
Option Explicit

Private 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

Private Type TIME_ZONE_INFORMATION
Bias As Long
StandardName(32) As Integer
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName(32) As Integer
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type

Private Declare Function GetTimeZoneInformation _
Lib "kernel32" _
(lpTimeZoneInformation As TIME_ZONE_INFORMATION) _
As Long
Public Function CompareDateTimes(ByVal dtZulu As Date, ByVal dtLocal As
Date) As Long
' returns difference in seconds
Dim TZI As TIME_ZONE_INFORMATION

GetTimeZoneInformation TZI

dtZulu = DateAdd("n", TZI.Bias, dtZulu)

CompareDateTimes = DateDiff("s", dtZulu, dtLocal)

End Function


--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #2

P: n/a
Don't you want to know that it is, in fact, daylight savings time when the
code is run?
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Lyle Fairfield" <Mi************@Invalid.Com> wrote in message
news:Xn*******************@130.133.1.4...
Lyle Fairfield <Mi************@Invalid.Com> wrote in
news:Xn*******************@130.133.1.4:
I'm guessing I have to go to API to convert safely regardless of time
zone to which the computer is defaulted?


Well, this was not so tough; I thought it would require a lot of
conversions from VBA datetimes to SystemTimes, but one can just use the
Time Zone Information Bias:

Option Compare Database
Option Explicit

Private 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

Private Type TIME_ZONE_INFORMATION
Bias As Long
StandardName(32) As Integer
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName(32) As Integer
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type

Private Declare Function GetTimeZoneInformation _
Lib "kernel32" _
(lpTimeZoneInformation As TIME_ZONE_INFORMATION) _
As Long
Public Function CompareDateTimes(ByVal dtZulu As Date, ByVal dtLocal As
Date) As Long
' returns difference in seconds
Dim TZI As TIME_ZONE_INFORMATION

GetTimeZoneInformation TZI

dtZulu = DateAdd("n", TZI.Bias, dtZulu)

CompareDateTimes = DateDiff("s", dtZulu, dtLocal)

End Function


--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)

Nov 12 '05 #3

P: n/a
"Michael \(michka\) Kaplan [MS]" <mi*****@online.microsoft.com> wrote in
news:40********@news.microsoft.com:
Don't you want to know that it is, in fact, daylight savings time when the
code is run?


Not this time.

But if you have a simple procedure for doing so, I'd be happy to add it to my
library, and to say, "Thanks".

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #4

P: n/a
Lyle Fairfield <Mi************@Invalid.Com> wrote in
news:Xn*******************@130.133.1.4:
"Michael \(michka\) Kaplan [MS]" <mi*****@online.microsoft.com> wrote in
news:40********@news.microsoft.com:
Don't you want to know that it is, in fact, daylight savings time when
the code is run?


Not this time.

But if you have a simple procedure for doing so, I'd be happy to add it
to my library, and to say, "Thanks".

OK ... upon further review ... I should allow for Daylight Saving Time,
although I am comparing the dates of two files and am not concerned in this
particular instance with any difference less than a few hours.

So ...

Const TIME_ZONE_ID_INVALID As Long = &HFFFFFFFF
Const TIME_ZONE_ID_UNKNOWN As Long = &H0
Const TIME_ZONE_ID_STANDARD As Long = &H1
Const TIME_ZONE_ID_DAYLIGHT As Long = &H2

Private 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

Private Type TIME_ZONE_INFORMATION
Bias As Long
StandardName(32) As Integer
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName(32) As Integer
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type

Private Declare Function GetTimeZoneInformation _
Lib "kernel32" _
(lpTimeZoneInformation As TIME_ZONE_INFORMATION) _
As Long

Public Function CompareDateTimes( _
ByVal dtZulu As Date, _
ByVal dtLocal As Date, _
Optional Bias As Long = 300) As Long
' returns difference in seconds
' defaults to Eastern North America Time ... Tronna

Dim TZI As TIME_ZONE_INFORMATION

Select Case GetTimeZoneInformation(TZI)
Case TIME_ZONE_ID_UNKNOWN
If TZI.Bias > Bias Then
Bias = TZI.Bias
End If
Case TIME_ZONE_ID_STANDARD
Bias = TZI.Bias
Case TIME_ZONE_ID_DAYLIGHT
Bias = TZI.DaylightBias
End Select
dtZulu = DateAdd("n", Bias, dtZulu)
CompareDateTimes = DateDiff("s", dtLocal, dtZulu)

End Function

I sort my declarations alphabetically so I may have left some pertinent
declaration out, or included a redundancy.
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.