Input Date format : 2019-07-09-10.56.24.147431
Desired Date Format: 09-JUL-19
I need to do the above in XSLT (version 1.0)
I tried the below :
<xsl:value-of select="concat (substring (xp20:format-dateTime(substring(/ns0:outbound/ns0:cancel_wrk/ns0:hdr_data/ns0:ts_ext, 1,10),'[DD]-[MNn,3-3]-[YYYY]'), 1,6 ), substring (year-from-date (date(substring(/ns0:outbound/ns0:cancel_wrk/ns0:hdr_data/ns0:ts_ext, 1,10))), 3 ) )"/>
<tns:xtrnlSysDttm>
<xsl:value-of select="concat (substring (xp20:format-dateTime(substring(/ns0:outbound/ns0:cancel_wrk/ns0:hdr_data/ns0:ts_ext, 1,10),'[DD]-[MNn,3-3]-[YYYY]'), 1,6 ), substring (year-from-date (date(substring(/ns0:outbound/ns0:cancel_wrk/ns0:hdr_data/ns0:ts_ext, 1,10))), 3 ) )"/>
</tns:xtrnlSysDttm>
Error message while inserting into SQL database with the result of the above XSLT:
BINDING.JCA-12563 Exception occurred when binding was invoked. Exception occurred during invocation of JCA binding: "JCA Binding execute of Reference operation 'insert' failed due to: DBWriteInteractionSpec Execute Failed Exception. insert failed. Descriptor name: [GBE_INT_CSS_PQ_PQFFEFO.PqffefoProxy]. Caused by Exception [EclipseLink-3001] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.ConversionException Exception Description: The object [25-Aug-19], of class [class java.lang.String], could not be converted to [class java.sql.Timestamp]. Internal Exception: BINDING.JCA-11635 Could Not Convert Date Exception. Unable to convert a string value in the xml to a java.sql.Date. Even though databases accept strings representing dates in a variety of formats, the adapter only accepts strings representing dates in xml ISO date format. The input value must be in the iso 8601 date format YYYY-MM-DD.