String To Date Conversion inside XSLT
697692Nov 30 2009 — edited Nov 30 2009Hi All,
I want to convert a string of (Eg:06/12/2009 00:00:00) to a date type of format yyyy-mm-dd Vice versa.
I am successful in converting Date to String
<element name="input" type="date"/> (Schema)
<element name="result" type="string"/> (Schema)
<ns1:SIDtoCRMProcessResponse>
<ns1:result>
<xsl:value-of select='xp20:format-dateTime(/ns1:SIDtoCRMProcessRequest/ns1:input,"[M01]/[D01]/[Y0001] [H01]:[m01]:[s01]")'/>
</ns1:result>
</ns1:SIDtoCRMProcessResponse>
but when try to do String to Date
<element name="input" type="string"/> (Schema)
<element name="result" type="date"/> (Schema)
<ns1:CRMToSIDProcessResponse>
<ns1:result>
<xsl:value-of select='xp20:format-dateTime(/ns1:CRMToSIDProcessRequest/ns1:input,"[Y0001]-[M01]-[D01]")'/>
</ns1:result>
</ns1:CRMToSIDProcessResponse>
its failing
I think format-dateTime function expects input as date. Can anyone kindly help me how to convert String to Date inside an xsl without using external java function.
Thank You