Item syntax for VTQ timestamp
- Last UpdatedAug 27, 2024
- 2 minute read
Each payload from a web service has an associated time value, that shows the time of occurrence of an event. By default, the Communication Driver time-stamps the references with the local time from the computer running the Communication Driver, and not the time the event occurred.To obtain an accurate timestamp value of a data field, the REST-based connections support the &T& syntax, that concatenates the data field and the time field.
<Value_Reference>&T&<Time_Reference>
If a value item is X and the time item is Y, the resulting read-only item X&T&Y displays the value X timestamped with the value of Y.
Prerequisites for using the &T& Item Syntax
-
A time field must be available in the data record.
-
The time field can be either:
-
Unix timestamp
Example 1: 1507103430 = Wednesday October 4 2017 07:50:30 UTC
Example 2: 1507103432 = Wednesday October 4 2017 07:50:32 UTC
-
ISO 8601 timestamp string in UTC format
Example 1: 2017-10-04T07:50:30Z = Wednesday October 4 2017 07:50:30 UTC)
Example 2 (when time is in ms): 2017-10-04T07:50:30.134Z = Wednesday October 4 2017 07:50:30.134 UTC).
Note: The ISO 8601 timestamp string ends with Z.
-
Example
Consider the following payload, where the item reference is Tank_Temp, and time stamp is available in both ISO and Unix formats.
Tank_Temp {"Temp":11.6, "TimeISO":" 2017-09-07T10:05:02.000Z", "TimeUnix": 1505392739}
-
To get the temperature time stamped with ISO Time:
Tank_Temp.Temp&T&Tank_Temp.TimeISO
or
Tank_Temp.Temp&T&.TimeISO
-
To get the temperature time stamped with Unix Time:
Tank_Temp.Temp&T&Tank_Temp.TimeUnix
or
Tank_Temp.Temp&T&.TimeUnix
