Use maps to convert data stored in Date format in the database to the String format used by a WebSphere Business Integration Adapter business object.
For example, assume that you want to convert the following date, which is stored in an Oracle database:
Sun Jan 01 00:00:00 CEST 1999
to the following string, which is processed in a WebSphere Business Integration Adapter for JDBC business object:
Jan 01 1999 00:00:00
To perform this conversion, use the DtpDate() and DtpSplitString() constructors defined for data transformation in mapping. For the syntax and a description of these constructors and the classes whose objects they construct, see the Map Development Guide.
To use a map to convert the Date value to a String, follow these steps:
DtpSplitString OurSplitString = new DtpSplitString ("Sun Jan 01 00:00:00 CEST 1999"," ");
In the above statement, OurSplitString is a user-defined variable of type DtpSplitString, and a space is specified as the delimiter.
String[] OurStringPieces = new String[6]; for (i=0;i<=5;i=i+1){ OurStringPieces[i]=OurSplitString.nextElement(); }
This looping produces the following array elements:
OurStringPieces[0] = Sun OurStringPieces[1] = Jan OurStringPieces[2] = 01 OurStringPieces[3] = 00:00:00 OurStringPieces[4] = CEST OurStringPieces[5] = 1999
OurConcatenatedString = OurStringPieces[1]+OurStringPieces[2]+OurStringPieces[5]+OurStringPieces[3];
DtpDate OurDtpDate = new DtpDate(OurConcatenatedString,"M D Y h:m:s");
After you have put the Date value into DtpDate format, you are ready to work with the date in your map.