Function DayLightSavingsTime

T

Tim

Any suggestions regarding a way to determine if day light savings time is in
effect.

Thanks in Advance.
 
T

Tim

I think I have it figured out.

Option Explicit

#If Win32 Then
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 As String * 64
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName As String * 64
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type
#End If 'WIN32 Types

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

Sub a()
MsgBox DayLightSavings
End Sub

Function DayLightSavings() As Boolean
Dim myTZ As TIME_ZONE_INFORMATION, tl As Long
DayLightSavings = False
tl = GetTimeZoneInformation(myTZ)
If tl = 2 Then
DayLightSavings = True
End If
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top