Format dateTime problems in Tibco BusinessWorks and General Interface
Facts - Tibco
Thursday, 20 December 2012 19:03

This note is for Tibco BusinessWorks 5.6 and General Interface 3.9.

I had to send a date time in xsd format from BusinessWorks to a javascript/General Interface frontend. My first question was how to parse the xsd date from BusinessWorks within the General Interface javascript code.

For this General Interface has the object jsx3.util.DateFormat. To successfully use the parse function of this object one has to limit the xsd date format sent by BusinessWorks. So I tried using the following XPath function in the BusinessWorks mapper:

tib:format-dateTime("yyyy-MM-ddTHH:mm:ss",myDate)

Note that this XPath transformation did not map to the xsd type string but to xsd type dateTime. This mapping triggered the following error in BusinessWorks:

Error [] null Job-270000 Error in [Definitions/MyProcess.process/End]
java.lang.IllegalArgumentException: Illegal pattern character 'T'
	at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:678)
	at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:497)
	at java.text.SimpleDateFormat.(SimpleDateFormat.java:446)

Surrounding the T with single quotes fixed this problem:

tib:format-dateTime("yyyy-MM-dd'T'HH:mm:ss",myDate)

Then I tried the javascript code for parsing the incoming xsd date:

var xsdDateTimeFormat = new jsx3.util.DateFormat("yyyy-MM-ddTHH:mm:ss");
var myJsDate = this.xsdDateTimeFormat.parse(myXsdDate);

This triggered an error as well. Again surrounding the T with single quotes fixed the problem:

var xsdDateTimeFormat = new jsx3.util.DateFormat("yyyy-MM-dd'T'HH:mm:ss");
var myJsDate = this.xsdDateTimeFormat.parse(myXsdDate);