I understand that this question could be answered by writing some test code. I'm not lazy, I just thought that the answer might be generally useful.
I have an application that generated a large amount of data with records that were marked with local time (as was returned using the NOW procedure). We encountered obstacles with transitions to and from daylight saving time - namely, that the hour when we switch to daylight saving time and the hour we repeat when we exit DST. This causes problems with manipulations that involve records sorted by date.
The application has been changed, therefore, to work with all dates in UTC, but I will have the opportunity to display dates in UTC or in local time. I also have to deal with datetimes that were saved in local time, and make sure they are correctly moved to UTC. This is tricky since datetime could be saved when the DST was in effect, so in general I need to determine if there is any random date inside or outside the daylight saving time period. Of course, there is a period of one hour, when the date-time is ambiguous and may be at the last hour before daylight ends, or at the first hour after it ends. Unable to resolve this.
When coding the changes, I wondered about the result of the NOW calls. Inside, it calls GetLocalTime. What does GetLocalTime (and NOW) return when you are in the DST period, but the "Set clock for daylight saving time" option is disabled?
How to write a procedure that returns the current datetime in the DST period (using the DST offset), regardless of whether the "Setting the clock for daylight saving time" is turned off or on?
source share