<?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 Setting the date/time field value to some specific time in EST time zone in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/setting-the-date-time-field-value-to-some-specific-time-in-est/m-p/2437533#M949721</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently our instance is in PST timezone. We have created a field on Incident form and I want to set the value as follows.&lt;/P&gt;&lt;P&gt;&amp;lt;Incident created date&amp;gt; &amp;lt;8 AM EST time zone&amp;gt;&lt;/P&gt;&lt;P&gt;which means, I want to convert 8 AM EST to PST and need to place that time value in that field.&lt;/P&gt;&lt;P&gt;Can anyone suggest me on this. Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ganesh&lt;/P&gt;</description>
    <pubDate>Mon, 09 Jan 2023 15:09:25 GMT</pubDate>
    <dc:creator>Community Alums</dc:creator>
    <dc:date>2023-01-09T15:09:25Z</dc:date>
    <item>
      <title>Setting the date/time field value to some specific time in EST time zone</title>
      <link>https://www.servicenow.com/community/developer-forum/setting-the-date-time-field-value-to-some-specific-time-in-est/m-p/2437533#M949721</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently our instance is in PST timezone. We have created a field on Incident form and I want to set the value as follows.&lt;/P&gt;&lt;P&gt;&amp;lt;Incident created date&amp;gt; &amp;lt;8 AM EST time zone&amp;gt;&lt;/P&gt;&lt;P&gt;which means, I want to convert 8 AM EST to PST and need to place that time value in that field.&lt;/P&gt;&lt;P&gt;Can anyone suggest me on this. Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ganesh&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 15:09:25 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/setting-the-date-time-field-value-to-some-specific-time-in-est/m-p/2437533#M949721</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2023-01-09T15:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Setting the date/time field value to some specific time in EST time zone</title>
      <link>https://www.servicenow.com/community/developer-forum/setting-the-date-time-field-value-to-some-specific-time-in-est/m-p/2437536#M949724</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Community Alums&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the script which can be useful for converting.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var dateTime = new GlideDateTime();
var targetTimezone = 'AST'; // provide the apt shortcut of timezone
var tz = Packages.java.util.TimeZone.getTimeZone(targetTimezone); 
dateTime .setTZ(tz);
var timeZoneOffSet = dateTime .getTZOffset();
dateTime .setNumericValue(dateTime .getNumericValue() + timeZoneOffSet);&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 Jan 2023 15:16:35 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/setting-the-date-time-field-value-to-some-specific-time-in-est/m-p/2437536#M949724</guid>
      <dc:creator>Basheer</dc:creator>
      <dc:date>2023-01-09T15:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Setting the date/time field value to some specific time in EST time zone</title>
      <link>https://www.servicenow.com/community/developer-forum/setting-the-date-time-field-value-to-some-specific-time-in-est/m-p/2437556#M949729</link>
      <description>&lt;P&gt;Something like this might work too, depending your context (this is an example):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var est = Packages.java.util.TimeZone.getTimeZone('US/Eastern');
var pst = Packages.java.util.TimeZone.getTimeZone('US/Pacific');
var estGdt = new GlideDateTime();
estGdt.setTZ(est);

var pstGdt = new GlideDateTime();
pstGdt.setTZ(pst);

estGdt.setValue('2011-02-02 08:00:00');
gs.print('Original time: ' + estGdt);

pstGdt.setValue(estGdt);
pstGdt.addSeconds(10800); // add 3 hours
gs.print('PST time: ' + pstGdt);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 15:40:30 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/setting-the-date-time-field-value-to-some-specific-time-in-est/m-p/2437556#M949729</guid>
      <dc:creator>laszloballa</dc:creator>
      <dc:date>2023-01-09T15:40:30Z</dc:date>
    </item>
  </channel>
</rss>

