Wednesday, 9 March 2016

String to Date Conversion in XSLT

String to Date Conversion in XSLT

This blog might be handy for you for quick date conversion from string to date. Like in our source is String DD-MON-YYYY format and I want to convert it to YYYY-MM-DD for making the JCA adapter recognize the same during updation in oracle table.I didn’t find out any in built function is available so I decided to use simple sql query in xslt.
image
I just used query-database function and sql query is constructed using string concatenation.
image
and if you look at the database function ,
image
and whole sqlquery is concat("select to_char(to_date('",/ns0:arrivalDate,"','DD-MON-YYYY'),'YYYY-MM-DD') arrivalDate from dual")
handy for me as well for future reference.

No comments:

Post a Comment