Mapping zero milliseconds to timestamps in Tibco BusinessWorks
Facts - Tibco
Monday, 04 July 2011 20:58

This note is for Tibco BusinessWorks 5.8.

I had to connect to a system and send them a timestamp containing the milliseconds. The timestamp field was defined in an XSD as follows:

<xsd:simpleType name="timestamp">
  <xsd:annotation>
    <xsd:documentation>E.g. 2010-01-02T03:04:05.210Z
  </xsd:annotation>
  <xsd:restriction base="xsd:dateTime">
    <xsd:pattern value="[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z"/>
  </xsd:restriction>
</xsd:simpleType>

The timestamp had to be mapped from an xsd datetime string that did not contain any milliseconds. So I had to make up the milliseconds. I did this by concatenating the date time and the string ".000Z" into the target timestamp field.

Surprisingly the milliseconds, ".000" were not sent to the other system. BusinessWorks sent a datetime of the form "2011-01-01T23:01:01Z" instead of "2011-01-01T23:01:01.000Z".

Of course my mapping with the concatenate did produce a result field of the form "2011-01-01T23:01:01.000Z". But then the result was passed to a field of exactly the same (xml) type in a subprocess. During the subprocess call the milliseconds mysteriously disappeared.

I think the input mapping of the subprocedure call would be fine if the base type had been xsd:string instead of xsd:dateTime. Instead of changing the base type of my timestamp I changed the milliseconds from ".000" to ".001" which solved the issue as well.