<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Convert DateTime from one time zone to another in scoped App and Global in Field Service Management forum</title>
    <link>https://www.servicenow.com/community/field-service-management-forum/convert-datetime-from-one-time-zone-to-another-in-scoped-app-and/m-p/3382380#M2549</link>
    <description>&lt;P&gt;how can we convert a time from one timezone to another timezone in both scoped applications and global?&lt;/P&gt;</description>
    <pubDate>Tue, 16 Sep 2025 15:27:24 GMT</pubDate>
    <dc:creator>mahesh009</dc:creator>
    <dc:date>2025-09-16T15:27:24Z</dc:date>
    <item>
      <title>Convert DateTime from one time zone to another in scoped App and Global</title>
      <link>https://www.servicenow.com/community/field-service-management-forum/convert-datetime-from-one-time-zone-to-another-in-scoped-app-and/m-p/3382380#M2549</link>
      <description>&lt;P&gt;how can we convert a time from one timezone to another timezone in both scoped applications and global?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 15:27:24 GMT</pubDate>
      <guid>https://www.servicenow.com/community/field-service-management-forum/convert-datetime-from-one-time-zone-to-another-in-scoped-app-and/m-p/3382380#M2549</guid>
      <dc:creator>mahesh009</dc:creator>
      <dc:date>2025-09-16T15:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Convert DateTime from one time zone to another in scoped App and Global</title>
      <link>https://www.servicenow.com/community/field-service-management-forum/convert-datetime-from-one-time-zone-to-another-in-scoped-app-and/m-p/3382397#M2551</link>
      <description>&lt;DIV&gt;&lt;PRE&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; convertDateTimeInGlobal(dateTimeStr, fromTimeZone, toTimeZone) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; gDate = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideDateTime&lt;/SPAN&gt;&lt;SPAN&gt;();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; gDate.setTimeZone(fromTimeZone);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; gDate.setDisplayValue(dateTimeStr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; gDate.setTimeZone(toTimeZone);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;&lt;SPAN&gt;(gDate.getDisplayValue());&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;gs.print(convertDateTimeInGlobal(&lt;/SPAN&gt;&lt;SPAN&gt;"2025-09-16 12:00:00"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"GMT"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"IST"&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; convertDateTimeInScopedAPP(dateTimeStr, fromTimeZone, toTimeZone) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; scheduleDateinfrTZ = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideScheduleDateTime&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"TZID="&lt;/SPAN&gt;&lt;SPAN&gt; + fromTimeZone + &lt;/SPAN&gt;&lt;SPAN&gt;";"&lt;/SPAN&gt;&lt;SPAN&gt; + dateTimeStr);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; dateTimeInternal = scheduleDateinfrTZ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; schedDateintoTz = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideScheduleDateTime&lt;/SPAN&gt;&lt;SPAN&gt;(dateTimeInternal);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; schedDateintoTz.setTimeZone(toTimeZone);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;/* Return the converted date-time as a string */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;&lt;SPAN&gt;(schedDateintoTz);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;gs.info(convertDateTimeInScopedAPP(&lt;/SPAN&gt;&lt;SPAN&gt;"2025-09-16 12:00:00"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"GMT"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"IST"&lt;/SPAN&gt;&lt;SPAN&gt;));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 16 Sep 2025 15:32:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/field-service-management-forum/convert-datetime-from-one-time-zone-to-another-in-scoped-app-and/m-p/3382397#M2551</guid>
      <dc:creator>mahesh009</dc:creator>
      <dc:date>2025-09-16T15:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Convert DateTime from one time zone to another in scoped App and Global</title>
      <link>https://www.servicenow.com/community/field-service-management-forum/convert-datetime-from-one-time-zone-to-another-in-scoped-app-and/m-p/3382400#M2552</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/605416"&gt;@mahesh009&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this will work in both&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;var now = new GlideDateTime();
gs.info("System Time is " + now);
var gsdt = new GlideScheduleDateTime(now);
gsdt.setTimeZone("Europe/London");
gs.info("London time is " + gsdt.getGlideDateTime().getDisplayValue());
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;Global Output&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnkurBawiskar_0-1758036818484.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/470504iF6A11C8BC42393E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AnkurBawiskar_0-1758036818484.png" alt="AnkurBawiskar_0-1758036818484.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Scoped Output&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AnkurBawiskar_1-1758036853223.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/470505iEF03715345BAD7B8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AnkurBawiskar_1-1758036853223.png" alt="AnkurBawiskar_1-1758036853223.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 15:34:25 GMT</pubDate>
      <guid>https://www.servicenow.com/community/field-service-management-forum/convert-datetime-from-one-time-zone-to-another-in-scoped-app-and/m-p/3382400#M2552</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-09-16T15:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Convert DateTime from one time zone to another in scoped App and Global</title>
      <link>https://www.servicenow.com/community/field-service-management-forum/convert-datetime-from-one-time-zone-to-another-in-scoped-app-and/m-p/3382430#M2553</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/605416"&gt;@mahesh009&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also shared a working solution.&lt;/P&gt;
&lt;P&gt;As per new community feature you can mark multiple responses as correct.&lt;/P&gt;
&lt;P&gt;If my response helped please mark it correct as well so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 15:49:52 GMT</pubDate>
      <guid>https://www.servicenow.com/community/field-service-management-forum/convert-datetime-from-one-time-zone-to-another-in-scoped-app-and/m-p/3382430#M2553</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-09-16T15:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Convert DateTime from one time zone to another in scoped App and Global</title>
      <link>https://www.servicenow.com/community/field-service-management-forum/convert-datetime-from-one-time-zone-to-another-in-scoped-app-and/m-p/3382445#M2554</link>
      <description>&lt;P&gt;While this solution converts time from the system's local time zone to another, my approach offers greater flexibility by enabling conversions between &lt;STRONG&gt;any two time zones&lt;/STRONG&gt;, regardless of the system timezone&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 15:56:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/field-service-management-forum/convert-datetime-from-one-time-zone-to-another-in-scoped-app-and/m-p/3382445#M2554</guid>
      <dc:creator>mahesh009</dc:creator>
      <dc:date>2025-09-16T15:56:15Z</dc:date>
    </item>
  </channel>
</rss>

