%REM Function CompareTZEDTEET Description: Performs check of zone and hour difference between EET and ET as enters and exits DST different weeks. %END REM Function CompareTZEDTEET(inNDT As NotesDateTime, debugMode As String) As Integer ' inNDT - incoming NDT to be adjusted ' debugMode - developer breadcrumbs ' return 0 for error ' at the time of this writing: ' - EET converts to EET to EEST (DST) at 3:00 AM - March - 4th Sunday ' - EET converts back to EET (w/o DST) at 4:00 AM - October - 4th Sunday ' - EST converts on second week of March and October respectively ' time is generally +6 or +7 hours difference from ET to EET depending on when DST activates Dim evalTxt As String ' formula string to evaluate Dim zoneTxtVar As Variant ' used to hold the converted time Dim zoneNDTTxt As String ' text output from Evaluate to turn back into a date Dim eetNDT As NotesDateTime ' set via zoneNDTTxt - used to get hour to compare with inNDT hour Dim etHr As Integer ' EDT/EST hour of inNDT Dim eetHr As Integer ' EET hour of eetNDT/zoneNDTTxt Dim hrsDiff As Integer ' hours difference On Error GoTo FErrorHandler CompareTZEDTEET = 0 ' convert to EET zone ' code examples: ' Z=9$DO=1$DL=4 1 1 10-1 1$ZX=3$ZN=Alaskan ' Z=7$DO=0$ZX=6$ZN=US Mountain ' Z=5$DO=1$DL=4 1 1 10 - 1$ZX=10$ZN=Eastern ' Z=-2$DO=1$DL=3 -1 1 10 -1 1$ZX=37$ZN=E. Europe ' z=Zulu time = Coordinated UTC (9 = alaskan, 8=pacific, 5=eastern) ' DO = DST ' DL = ST ' ZX = zone code ' ZN = zone designation evalTxt = |@TimeToTextInZone(@ToTime("| & inNDT.GMTTime & |");"Z=-2$DO=1$DL=3 -1 1 10 -1 1$ZX=37$ZN=E. Europe")| If (debugMode = "1") Then Print "(CompareTZEDTEET) evalTxt: " & evalTxt End If zoneTxtVar = Evaluate(evalTxt) zoneNDTTxt = CStr(zoneTxtVar(0)) If (debugMode = "1") Then Print "(CompareTZEDTEET) zoneNDTTxt: " & zoneNDTTxt End If Set eetNDT = New NotesDateTime(zoneNDTTxt) If (eetNDT Is Nothing) Then ' failed return 0 Exit Function End If ' get the current hour values etHr = Hour(inNDT.Lslocaltime) eetHr = Hour(zoneNDTTxt) hrsDiff = eetHr - etHr If (debugMode = "1") Then Print "(CompareTZEDTEET) ET Hr: " & CStr(etHr) & ", EET Hr: " & CStr(eetHr) & ", hrsDiff: " & hrsDiff End If If (hrsDiff < 0) Then ' negative time returned, perform 24 - CompareTZEDTEET to get normal hours difference again ' since CompareTZEDTEET is negative, we actually want 24 + -17, for example CompareTZEDTEET = (24 + hrsDiff) Else CompareTZEDTEET = hrsDiff End If FExit: Exit Function FErrorHandler: Print "(CompareTZEDTEET) Unexpected error: " & CStr(Err) & ", " & Error$ & ", line: " & CStr(Erl) Resume FExit End Function