1 Reply Latest reply on Nov 26, 2014 3:43 PM by Marcos Vainer Loeff

    UTC Time in PE expressions

      Hi, I am using IPICalculation.Calculate to get some archive statistics. I am using an expression similar to this: tagavg('sometag', '26-Nov-2014 00:00', '26-Nov-2014 01:00') How can I specify that the date/time that I provide in the starttime/endtime arguments is in UTC and not local time?
        • Re: UTC Time in PE expressions
          Marcos Vainer Loeff

          Hello Varban,


          If you take a look at the PI SDK Programming Reference, you will find:


          "Impact of Regional Settings


          Because the expression passed to this method and eventually to the server for evaluation is a string, the string formatting of numeric values becomes an issue.  Evaluation of a PE syntax string on any PI server assumes that English settings are used - decimals are periods.  If an application builds an expression string on a machine set to use non-English regional settings, care must be taken to avoid generating strings that violate the server's assumption. "


          From my understanding, although this is related to other regional issues, the logic is that same. You should provide the expression string that the PI Data Archive will process. Therefore, the timestamps provided within the expression should be set according to the PI Server timezone. A solution for that is to convert from UTC to the PI Server timezone before executing IPICalculate methods.


          Please refer to this thread to find out some ways to make this conversion.


          Hope it helps!