JCAPS 5.1.1 - How can I convert Date to Java.sql.Timestamp using java in the JCD code? (Doc ID 1025271.1)

Last updated on JULY 16, 2015

Applies to:

Oracle Java CAPS - Version 5.1.0 and later
Information in this document applies to any platform.

Goal

How can I convert Date to Java.sql.Timestamp? The code below compiles, but are they any jcaps typeConverter methods that can be used?

The print for Alert_1.getTimeStamp() returns the following in the logs:

[#|2006-11-01T13:24:13.831-0500|INFO|IS5.1.1|STC.eGate.CMap.Collabs.prjAlertMessage.svcJcdAlertMsg.prjAlertMessage.jcdAlertMsg|_ThreadID=25;ThreadName=JMS Async S3;Context=prjAlertMessagedpAlertMsg/jmsAlertTopic_svcJcdAlertMsg_ejb;|+++++++++ Time Stamp: Wed Nov 01 13:24:09 EST 2006|#]

It seems in the format :"EEE MMM dd HH:mm:ss zzz yyyy", it uses the following code:

java.util.Date alertTimeStamp;
java.text.SimpleDateFormat alertdateformat = new
java.text.SimpleDateFormat( "EEE MMM dd HH:mm:ss zzz yyyy" );
try {
    java.util.Date parsed = alertdateformat.parse(Alert_1.getTimeStamp() );
    logger.info( " after parse alert TimeStamp" + parsed.toString() );
    // Java.sql.Timestamp errorTimestamp = parsed;
    oraErrorMsg_1.getERROR_MSG().setDATESTAMP(errorTimeStamp );
} catch ( java.text.ParseException pe ) {
    logger.info( "+++++Date Parse Exception" + Alert_1.getTimeStamp() );
}

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms