AnsweredAssumed Answered

SDK VBA: Changing OS Timezone as default

Question asked by bartmch on Oct 3, 2017
Latest reply on Oct 6, 2017 by rdavin

Hi everybody, The VBA script I wrote to extract Pi Batches and then Pi Data will be running on multiple servers in different time zones. I'd like to convert any incoming user batch query into UTC time frame, get the batches, get the data for the batches and transform everything again into any user-specified time frame. I use "PITIME.inputstring = sUserInput" to convert any possible input string (eg "01-Jan-2017" or "*-10d") into a datetime. I can then use the datadiff("s", "PITIME.outputstring","1-Jan-1970") function to get a new pitime where I use UTCseconds to set the date into UTC. The issue is that, when creating this new PITIME to set the UTCseconds, it will automatically take the operating system default time zone (in my case "1-Jan-1970 04:00:00"). Should I correct newly created PITIMES from my timezone to the UTC+0 time zone? Or are there other ways like changing the default settings whereby the operating system time zone has been chosen? Any code snippet is more than welcome! Thanks

Outcomes