Gateway Tag Change Script "event.getCurrentValue().timestamp"

Hello,

I have a gateway tag change script that has the following code:

tag_path = event.tagPath.getParentPath()
data_value = event.getCurrentValue().value
timestamp = event.getCurrentValue().timestamp
tag_path_str = str(tag_path)
tag_full_name_str = str(event.tagPath)

I want to know what the format of the timestamp is. I understand the getCurrentValue returns a 'Qualified Value' which includes the value, quality and timestamp of the value. I am sending the payload file to Azure. When I get it in Azure the file name of the .json is a string of identifiers and the date and time appended at the end. I am looking to change the format of the date/time in the file name but do not know if this is possible using Ignition.

Any help is appreciated.

event.getCurrentValue().timestamp will return the timestamp in Ignition's millisecond format (number of ms since 1970-01-01 00:00:00). (See Phil's finer detail below.) Most of the components will recognise that it's a date and automatically convert it into the format Mon Jan 13 16:44:01 GMT 2025. Many components provide a dateFormat option to change this.

In a script you can format it any way you like using system.date.format | Ignition User Manual. See the Data Type Formatting Reference | Ignition User Manual for details.

1 Like

No, it is an actual instance of java.util.Date, which is milliseconds UTC under the hood.

2 Likes