Advertisement

02.06.2007 at 06:15PM PST, ID: 22152403
[x]
Attachment Details

New Daylight Savings Time Calculations

Asked by esmyhs in Visual Basic Programming

Tags: daylight, savings, time, calculation

I got this code from EE a while ago. It was posted by EDDYKT. I need to have it updated to take in to account the new Daylight Savings Time.

Thank you.

Option Explicit

Private Sub Command1_Click()
Debug.Print CalcDayLightBoundary(2003, 4, 1)
Debug.Print CalcDayLightBoundary(2003, 10, 2)
End Sub
Private Function CalcDayLightBoundary(Yr As Integer, Mon As Integer, Hr As Integer) As Date
    Dim tt As Date, NumDays As Integer
   
    On Error Resume Next
    tt = DateSerial(Yr, Mon, 1) + TimeSerial(Hr, 0, 0)
    NumDays = IIf(Weekday(tt) = 1, 0, 7 - Weekday(tt) + 1)
    If (Mon = 10) Then
        NumDays = NumDays + 28
        If (NumDays > 31) Then NumDays = NumDays - 7
    End If
    CalcDayLightBoundary = DateAdd("D", NumDays, tt)
End FunctionStart Free Trial
[+][-]02.07.2007 at 01:03AM PST, ID: 18483429

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.07.2007 at 02:32AM PST, ID: 18483716

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]02.07.2007 at 02:31PM PST, ID: 18489351

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.07.2007 at 04:19PM PST, ID: 18490092

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.09.2007 at 09:45AM PST, ID: 18503094

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Visual Basic Programming
Tags: daylight, savings, time, calculation
Sign Up Now!
Solution Provided By: lehman6676
Participating Experts: 2
Solution Grade: A
 
 
[+][-]02.09.2007 at 11:52AM PST, ID: 18504024

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32