DST code.

Gevonden opĀ woodsgood.ca.
Even hier parkeren.

// IsDST(): returns true if during DST, false otherwise
boolean IsDST(int mo, int dy, int dw) {
 if (mo < 3 || mo > 11) { return false; } // January, February, and December are out.
 if (mo > 3 && mo < 11) { return true; } // April to October are in
 int previousSunday = dy - dw; 
 if (mo == 3) { return previousSunday >= 8; } // In March, we are DST if our previous Sunday was on or after the 8th.
 return previousSunday <= 0; // In November we must be before the first Sunday to be DST. That means the previous Sunday must be before the 1st.
}