hari
hari

Reputation: 31

Convert GMT time local time in XSLT

How to convert GMT time to local time ( MDT or MST ) automatically.

I got this below working but i need a condition which determines utc -6 or utc -7 based on dates.

<xsl:value-of select="xs:dateTime($docdate) + xs:dayTimeDuration('-PT7H')"/>

Thanks Hari

Upvotes: 3

Views: 6735

Answers (2)

C. M. Sperberg-McQueen
C. M. Sperberg-McQueen

Reputation: 25034

You might look at the function adjust-time-to-timezone($arg as xs:time?), which adjusts the time given in $arg to the implicit timezone given in the dynamic context. There are no guarantees, but in many implementations that is likely to be the timezone set in the operating system environment.

For example, if I evaluate the expression

adjust-time-to-timezone( xs:time('20:45:00.0+01:00'))

my system (current set to 7 hours west of UTC) returns the value

12:45:00-07:00

Upvotes: 2

Mihai8
Mihai8

Reputation: 3147

You can use a script, for example a javascript using javascript dates.

Upvotes: -1

Related Questions