DateTime
Note: The Siemens driver does not support Ignition tag's DateTime type. In these cases it is recommended to extract each byte in in the Siemens DATE_AND_TIME value item, storing each into a separate Ignition tag. Then use an expression tag to combine each byte into a human readable datetime.
// The following assumes each byte of the DATE_AND_TIME value is under a tag named like "BASIC_DATA_AND_TIME", and that each tag is a String type.
"20" + //First part of the year, assuming in 21st century
toHex({[.]BASIC_DATE_AND_TIME[0]}) + “-” + //Second part of the year, reading from an Ignition tag.
numberFormat(toHex({[.]BASIC_DATE_AND_TIME[1]}), “00”) + “-” + //Month
numberFormat(toHex({[.]BASIC_DATE_AND_TIME[2]}), “00”) + “-” + //Day
numberFormat(toHex({[.]BASIC_DATE_AND_TIME[3]}), “00”) + “:” + //Hours
numberFormat(toHex({[.]BASIC_DATE_AND_TIME[4]}), “00”) + “:” + //Minutes
numberFormat(toHex({[.]BASIC_DATE_AND_TIME[5]}), “00”) + “:” + //Seconds
numberFormat(fromBinary(left(numberFormat(toBinary({[.]BASIC_DATE_AND_TIME[6]} + {[.]BASIC_DATE_AND_TIME[7]}), “0000000000000000”), 12)), “000”) + " " + //Milliseconds, it includes the first 4 bits of byte 7
case( //Day of the week, last 4 bits of byte 7
right(numberFormat(toBinary({[.]BASIC_DATE_AND_TIME[7]}), “00000000”), 4),
“0000”, “Sunday”,
“0001”, “Monday”,
“0010”, “Tueday”,
“0011”, “Wednesday”,
“0100”, “Thursday”,
“0101”, “Friday”,
“0111”, “Saturday”,
“Error - No Day Found”)