Calculate Daylight Saving Time (US/EU)

Submitted by:Tim Kelly

Date added:14 March, 2012

Category:ASP

Scripts used to calculate Daylight Saving Time (DST) for the US and EU. Valid for years 1900 to 2099. [DST wasn't adopted until the 1950s-1960s for US and 1990s for the EU]
By: brad degrandis

Tags: calculate scripts

Code Snippet:

<%
y = datepart("yyyy", date())
' REM UNITED STATES CALCULATION:
DST_US_SPRING = (2+6*y-y/4) mod 7+1
DST_US_FALL = (31-(y*5/4+1) mod 7)
response.write("US_SPRING: Sunday, April " & DST_US_SPRING & " " & y & " <br>")
response.write("US_FALL: Sunday, October " & DST_US_FALL & " " & y & "<br>")
' REM EUROPEAN UNION CALCULATION:
DST_EU_SPRING = (31 - (5*y/4 + 4) mod 7)
DST_EU_FALL = (31 - (5*y/4 + 1) mod 7)
response.write("EU_SPRING: Sunday, " & DST_EU_SPRING & " March " & y & "<br>")
response.write("EU_FALL: Sunday, " & DST_EU_FALL & " October " & y)
%>
 
 

Comments