Weird Timezone issue
Hi All,
I am writing a script to create an appointment 15 mins from now when a SuperOffice form is processed. However when I initialize a datetime variable it is setting it for 1 hour in the future. I have written a test script below to show the issue.
#setLanguageLevel 4;
DateTime now;
print (now.toString() + "<BR>");
TimeZone ltz = getLocalTimeZone();
print (ltz.getTimeZone() + "<BR>");
print (ltz.getTimeZoneSecs().toString());
If I run this script on my test on-premise environment, these are the results I get.
If I run the same script on the customer's online environment, I get the following results.
I originally thought it was because Timezones, were not enabled on the customer's environment, but I have enabled these, and the system default, and my personal default is set to "United Kingdom", as it is in my test system, so I don't understand whilts I am getting different results. It may be because my on premise server is hosted on a server configured for the UK, whereas the online environment would be, I assume, configured for Norway, and I guess British Summer Time is also causing part of the issue. But how do I get the current datatime for the UK, that will work all year round, both in and out of BST.
Many thanks,
Trevor
Allt Svar (2)
Hi Trevor,
DateTime is returning as you have noticed local server time, and online servers are located in Norway. But based on LocalTimeZone you should be able to find difference from UTC and convert it accordingly.