Android Code Snippet [B4X] Daylight Saving Time for Israel

derez

Expert
Licensed User
The day Israel switches from winter time to summer time offset is defined as the Friday before the last Sunday of March.
This is calculated by the following code, the parameter is the year (e.g 2019):
B4X:
Sub find_dst(ty As Int) As Int
    Dim p As Int = ty/4
    Return 29 - (32 + ty + p ) Mod 7
End Sub
The day to switch back to winter offset is the last Sunday of October, it is calculated by ref to dst3, the day in March:
B4X:
If dst3 > 26 Then dst10 = dst3 - 2 Else dst10 = dst3 + 5
The code does not use DateTime functions so it can be used in B4R.
 
Top