I have a date in this format
10/12/2011 12:55:00 PM (MM-DD-YYYY time)
I would like to format this date into
12/10/2011 (DD-MM-YYYY) time to be removed
using XSLT? the complexity I find is sometimes the input date can look like
7/12/2011 12:55:00 PM (only one number to the front instead of 07)
Can someone please show me a way to implement this? many thanks in advance.
It is easy to obtain desired result using only standard XPath string functions like substring-before
, substring-after
and substring
, e.g.:
<xsl:variable name="input">7/12/2011 12:55:00 PM</xsl:variable>
<xsl:value-of select="concat(
substring-before(substring-after($input, '/'), '/'), '/',
substring-before($input, '/'), '/',
substring(substring-after(substring-after($input, '/'), '/'), 1, 4)
)"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With