Detecting if Dayligh Saving Time within Access

I have an Access database that creates iCalendar/vCalendar files.  The files are created correctly, but if Daylight Saving Time is in operation it adds an hour to the time when opened in Outlook.  

This was working fine, until the clocks went forward a few weeks ago.

Any ideas?
Andy BrownDeveloperAsked:
Who is Participating?
Try this:
Public Function IsDST(ByVal dDate As Date) As Boolean
'* Copyright © 2005  Camarillo Technology Associates (
'* Updated for new DST guidelines 4/30/2009 by Sean Strickland
  Dim dStartDST As Date
  Dim dEndDST As Date
  Dim DaysTilSun As Long
  If Not IsDate(dDate) Then Exit Function
  If Year(dDate) = 1899 Then Exit Function
  '* 1899 means it's probably a time-only value, so just bail
  '* Figure out the DST start/end for the supplied year
  '  (Assume DST rules as of now - 4/30/2009)
  '* Figure out how many days after Mar 8, [Supplied Year] that Sunday occurs
  '   Then set when DST starts
  DaysTilSun = 8 - Weekday("March 8, " & CStr(Year(dDate)), vbSunday)
  If DaysTilSun = 7 Then DaysTilSun = 0
  dStartDST = DateAdd("d", DaysTilSun, "March 8, " & CStr(Year(dDate)))
  '* Figure out how many days before Nov 1, [Supplied Year] that Sunday occurs
  '   Then set when DST starts
  DaysTilSun = Weekday("November 1, " & CStr(Year(dDate)), vbSunday) - 1
  dEndDST = DateAdd("d", -DaysTilSun, "November 1, " & CStr(Year(dDate)))
  '* Note that ANYtime on the Sunday that DST starts is considered DST and
  '   ANYtime on the day it ends is considered ST
  IsDST = DateDiff("d", dDate, dStartDST) <= 0 And _
   DateDiff("d", dDate, dEndDST) > 0
End Function

Open in new window

Andy BrownDeveloperAuthor Commented:
Perfect - thank you - very much appreciated.

Just out of curiosity, if I had a client in another part of the World (we are in the UK), would I to run any other checks?

Yeah.  The only bad thing about this function is that it has to use static start/end dates for DST.  I'm honestly not sure how you would set it up for clients that span multiple regions with different DST start/end dates.  I would assume that you would need a table somewhere that defined where each client was located and have logic built into the function to support that.
Andy BrownDeveloperAuthor Commented:
What a pain.  Thanks for all of your help on this.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.