I want to convert the 31-DEC-2016 i.e., dd-mmm-yyyy to yyyy-mm-dd in the XSLT using format-dateTime function but the output is not as expected.Can anyone help on this?
<ns1:QuoteDate>
<xsl:value-of select='concat(xp20:format-dateTime(/Quote/QuoteHeader/QuoteDate,"[Y0001]-[M01]-[D01]"),"T00:00:00")'/>
</ns1:QuoteDate>
I want to get the value for this particular thing.31-DEC-2016 : This is the input and i have to transform over here in the code
Once that is converted, How to concat the the value T00:00:00 to the date??
If you're formatting only dates, I could suggest
format-date(date, format)
Maybe this can help you,
http://www.sixtree.com.au/articles/2013/formatting-dates-and-times-using-xslt-2.0-and-xpath/
You cannot use the
format-dateTime()
function on a string that is not a valid dateTime (or theformat-date()
function on a string that is not a valid date). You need to process the string using string functions first.Try:
Calling this template with a datestring parameter of "31-DEC-2016" will return a value of "2016-12-31".
Example of call (mostly guessing, not having seen the input):
In XSLT 2.0, you can define a function instead of a named template. The following stylesheet:
XSLT 2.0
will return: