prime
prime

Reputation: 809

Add millisecond to xslt format-time method

There is an xml element called Qtime with timestamp. Qtime element format can be changed. Sample format for the Qtime element is shown below.

<Qtime>14:00:00.000Z</Qtime>

So, I used following xslt transformation to convert Qtime element.

<xsl:value-of select="format-time(Qtime, '[H01]:[m01]:[s01]')" />

Now, I want to add millisecond to output element. And, I tried with the following command and it is not working.

<xsl:value-of select="format-time(Qtime, '[H01]:[m01]:[s01].[S001]')" />

Is there any specific way to add milliseconds to format-time()?

Upvotes: 1

Views: 2380

Answers (1)

Tim C
Tim C

Reputation: 70648

Use f for fractions of a second....

<xsl:value-of select="format-time(Qtime, '[H01]:[m01]:[s01].[f001]')" />

See https://www.w3.org/TR/xslt20/#date-picture-string for a full list of possible "picture strings"

Upvotes: 1

Related Questions