Mohamed Uvais M
Mohamed Uvais M

Reputation: 305

Converting the string to xsd:date using xslt

Is there any way to convert the date which is a string(in the source) into a xsd:date(in the target) .

SourceXML :

<?xml version="1.0" encoding="UTF-8"?> <root> <endDate>2016-07-08T02:05:58.058Z</endDate> </root>

Expected targetXML :

<?xml version="1.0" encoding="UTF-8"?> <return> <date>2016-07-08+05:58</date> </return>

In source it is string, where the target expect this as xsd:date. suggestions please.

Upvotes: 0

Views: 124

Answers (1)

michael.hor257k
michael.hor257k

Reputation: 117165

IMHO, you could use simply:

substring-before(endDate, 'T')

to extract the date portion of the given dateTime.

Upvotes: 1

Related Questions