leandropoblet
10 years agoFrequent Contributor
Daylight saving issue
Hi all! Just a question regarding daylight saving and the time difference between UTC and local time. Every time we have to add (or substract) one hour because of that it causes the test's ru...
- 10 years ago
I just receive this from support and it's quite useful. Thanks guys!
function DST() { var key, valueName, i; key = Storages["Registry"]("System\\CurrentControlSet\\Control\\TimeZoneInformation", HKEY_LOCAL_MACHINE, 0, true); ActiveTimeBias = key["GetOption"]("ActiveTimeBias", ""); Bias = key["GetOption"]("Bias", ""); if (ActiveTimeBias == Bias) Log.Message("DST is inactive"); else Log.Message("DST is active"); }
- 9 years ago
leandropoblet wrote:
The question is if there's any function in C# script similar to
bool isDaylight = TimeZoneInfo.Local.IsDaylightSavingTime(thisTime);
You can access .NET classes via the dotNET object, so the TestComplete version of this code would be:
var thisTime = dotNET.System.DateTime.zctor_6(2010, 1, 10, 0, 0, 0, dotNET.System.DateTimeKind.Utc); var isDaylight = dotNET.System.TimeZoneInfo.Local.IsDaylightSavingTime(thisTime));