Check If a Date/time Value is During Daylight Savings or Standard Time

Category:
Dates and Math
Type:
Snippets
Difficulty:
Intermediate

Author: Anonymous

Version Compatibility: Visual Basic 6, Visual Basic 5, Visual Basic Script

More information:
I found this code here on VBcode.com and adjusted it for the new daylight savings dates for 2007 and beyond. Original Post: More information: I needed a way, using ASP, to check a datetime value to see if it is during Daylight Savings or Standard time. This way, I could correctly show the timezone, standard or daylight, or accurately calculate the GMT value for the datetime. I wrote this function to help me accomplish this. It is written in vbscript for ASP, but could easily be converted to VB, VB.Net. This will run as is in VS6. For demo purposes, simply add a Command button control to your WinForm.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: