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

有帮助吗?

解决方案

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

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top