Joe B
Joe B

Reputation: 788

xslt tansform Displaying time with the localtime zone

My xml value is <SaleDate>2017-12-28T13:30:08.1398094-05:00</SaleDate> my xsl

<xsl:value-of select="ms:format-date(m:SaleHeader/m:SaleDate, 'MMM dd yyyy')"/> <xsl:text> </xsl:text> <xsl:value-of select="ms:format-time(m:SaleHeader/m:SaleDate, 'h:mm tt')"/>

and in html I get the value Dec 30 6:30 PM that's the UTC value how do I get it should display the local time

Upvotes: 0

Views: 45

Answers (1)

Iurii  Kvashuk
Iurii Kvashuk

Reputation: 409

I suppose in your case it is possible to use substring before formatting. Then it will provide the expected result.

<xsl:value-of select="ms:format-date(substring(m:SaleHeader/m:SaleDate, 1, 19), 'MMM dd yyyy')"/> 

<xsl:value-of select="ms:format-time(substring(m:SaleHeader/m:SaleDate, 1, 19), 'h:mm tt')"/>

Upvotes: 1

Related Questions