Hi,
Daylight savings starts on the last Sunday in October and Standard time starts on the 1st Sunday in April so...
Here's something that is **not tested**
Public Function IsDaylightSavings() As Boolean
Dim intLastSunday As Integer
Dim intFirstSunday As Integer
Dim dtDaySav As Date
Dim dtStandard As Date
'dayight savings is the last sunday in Oct
'get the day that the 31st is
intLastSunday = WeekDay(DateSerial(DatePart("yyyy", Date), 10, 31))
Select Case intLastSunday
Case 1
'this is it, the 31st is the last Sunday
dtDaySav = DateSerial(DatePart("yyyy", Date), 10, 31)
Case Else
'subtract the correct number of days from the 31st to get the Sunday
dtDaySav = DateSerial(DatePart("yyyy", Date), 10, 31 - 1 - intLastSunday)
End Select
'standard time begins on the 1st Sunday in April
'get the day that is the 1st of April
intFirstSunday = WeekDay(DateSerial(DatePart("yyyy", Date), 4, 1))
Select Case intFirstSunday
Case 1
'this is it, the 31st is the last Sunday
dtStandard = DateSerial(DatePart("yyyy", Date), 4, 1)
Case Else
'add the correct number of days from the 1st to get the Sunday
dtStandard = DateSerial(DatePart("yyyy", Date), 10, 1 + (8 - intLastSunday))
End Select
If Date < dtDaySav And Date > dtStandard Then
IsDaylightSavings = False
Else
IsDaylightSavings = True
End If
End Function
--
HTH
Dan Artuso, Access MVP
Mike said:
Thanks...that works. Any way of having code check the
system clock to determine if it's daylight savings? I
really didn't want to go in and change the code each year.
-----Original Message-----
If Date() Between [StartDateForDST] And [EndDateDST] Then
..... Today is DST
Else
.... Today is not DST
End If
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com
I have an odd request. I have two forms with US timezone
maps - one for daylight savings and one without. I'd like
to be able to open up the correct map depending on whether
it's daylight saving or not.
I use Mike Kaplan's NowPlusTZBias for replication. Is
there a way of determining whether "today" is daylight
savings time or standard?
Thanks
Mike
.