Timestamps vary by the UTC offset in scripts based on WS timezone

Timestamps vary by the UTC offset in scripts based on WS timezone


Timestamps in Script programs are different by an amount equal to the UTC offset of the workstation's timezone settings.

Product Line

EcoStruxure Building Operation


  • Building Operation Enterprise Server
  • Building Operation Automation Server (AS, AS-P, AS-B)
  • Building Operation WorkStation Script editor


Take the following program as an example:

Datetime Output TimeOut, TimeOut2
TimeOut = StrToDate ("1/17/2012 15:00")
TimeOut2 = StrToDate ("1/17/2012 3:00 PM")

In StruxureWare Building Operation, the values will read:  "1/17/2012 9:00:00 AM" (in this example, the UTC offset is set for -6).

In servers, all time values are stored in UTC, then the offset is applied by the client.  When it receives a value from a Script program, it stores the value as UTC, then the offset for the selected timezone is applied.


There are two workarounds:

  1. On the Workstation PC, set the PC's time to UTC
  2. Write code in the Script program to adjust the time values to UTC.

Also see the example code below to help understand operation

Datetime Output dtOut1
Datetime Output dtOut2
String Output str1
dtOut1 = Date 'Local time; displays with added UTCOffset
dtOut2 = Date - UTCOffset 'Local time, adjusted by the UTCOffset, displays properly
Print Date to str1 'Local time String value displays properly

(UTCOffset system variable was added in v2.0)

Tags (2)
Labels (1)
No ratings