Standard or Daylight Savings Time Period Function
This is a function that will automatically (based on U.S. time changes) will determine if your date/time is during the standard time period or during the daylight saving time period. An example of this may be if you are pulling data out of a database to create an RSS file where the time zone must be specified to conform (and be valid) to the RSS 2.0 Specifications.
This function is based on the new time change schedule in the United States of changing to Daylight Saving Time at 2:00 AM on second Sunday in March and changing back to Standard Time on first Sunday in November at 2:00 AM.
The function shown here, represents the Pacific Time Zone. So you will need to change the abreviations accordingly. Here is a list of U.S. time zone abbreviations:
Hawaii is not listed above, because Hawaii does not observe Daylight Saving Time.
Here is an example of how to use it.
The output is 3/25/2017 6:35:43 PM PDT
Here is the ASP code for the StDst() function:
Function StDst(TheDate) TheDate = CDate(TheDate) DstStart = CDate("03/08/" & Year(Date()) & " 02:00") DstEnd = CDate("11/01/" & Year(Date()) & " 02:00") While Weekday(DstStart) <> 1 DstStart = DstStart + 1 Wend While Weekday(DstEnd) <> 1 DstEnd = DstEnd + 1 Wend If TheDate >= DstStart AND TheDate <= DstEnd Then StDst = TheDate & " PDT" Else StDst = TheDate & " PST" End If End Function