xslt Date Formatting and converting back to DateTime - BusinessWorks

394 Views Asked by At

I am trying to format a dateTime to remove the milliseconds part and just have seconds (e.g. 2015-04-07T17:13:19Z)

The issue is that when i use the dateTime function in XSLT as xpath in the BW Designer i need to convert the output string back into a dateTime. BW does not support functions in the editor or EXSLT.

The xsl: element executionDateTime: current()/ns4:tradeHeader/ns4:partyTradeInformation[1]/ns4:executionDateTime

@executionDateTimeScheme element current()/ns4:tradeHeader/ns4:partyTradeInformation[1]/ns4:executionDateTime/@executionDateTimeScheme

Please help if you can

Thanks

2

There are 2 best solutions below

0
On

try this:

tib:parse-dateTime('yyyy-MM-dd HH:mm:ss', translate(<<insertYourString>>, 'TZ', ' '))

input: string(2015-04-07T17:13:19Z)

output: dateTime

4
On

Assuming your input is a UTC datetime in the form of:

<input>2015-05-19T10:04:56.123Z</input>

you can use the expression:

concat(substring-before(input, '.'), 'Z')

to remove the milliseconds component and receive:

2015-05-19T10:04:56Z