user1915564
user1915564

Reputation: 3

xslt advanced date datetime conversion

I'm newbie in xslt and I'm not able to figure out a solution for my problem...

I've to create an xslt that permits to make a conversion from a DateTime to a DateString and viceversa.

From:

<dtStatus>2011-02-01T21:23:04Z</dtStatus>

To:

<dtStatus>110201 21:23:04</dtStatus>

How to create the xsl code to make this transformation?

Upvotes: 0

Views: 77

Answers (1)

djc
djc

Reputation: 11731

You can use the string functions to extract specific pieces of string and combine them back together again:

https://developer.mozilla.org/en-US/docs/XPath/Functions

For example, something like this should extract the date in your desired format:

concat(substring(dtStatus, 3, 2), substring(dtStatus, 6, 2), substring(dtStatus, 8, 2))

Upvotes: 1

Related Questions