سؤال

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