<?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>topic Re: How to set the UTC offset to 0 in an Info Window? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-the-utc-offset-to-0-in-an-info-window/m-p/49240#M4328</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would also add that the different browsers can treat the same JS date formatting code differently (I'm looking at you, IE)&amp;nbsp; so check your results in all browsers that your users may use with your application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For that reason, I use the &lt;A href="https://github.com/datejs/Datejs"&gt;date.js library&lt;/A&gt; for my date formatting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Jun 2015 14:55:31 GMT</pubDate>
    <dc:creator>SteveCole</dc:creator>
    <dc:date>2015-06-19T14:55:31Z</dc:date>
    <item>
      <title>How to set the UTC offset to 0 in an Info Window?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-the-utc-offset-to-0-in-an-info-window/m-p/49237#M4325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I asked a similar question on GIS SE the other day:&lt;/P&gt;&lt;P&gt;&lt;A href="http://gis.stackexchange.com/questions/151312/incorrect-time-displaying-in-arcgis-javascipt-popup-template/151316#151316" title="http://gis.stackexchange.com/questions/151312/incorrect-time-displaying-in-arcgis-javascipt-popup-template/151316#151316"&gt;Incorrect time displaying in ArcGIS Javascipt popup template&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The answer I got worked great for when I was using the PopupTemplate, but I've since switched to using the TooltipDialog or Info Window.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ArcMap, I have a field called ReadTime of Date data type, and it shows the value:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;6/17/2015 2:58:35 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using the following formatting for the TooltipDialog:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;"&amp;lt;b&amp;gt;Read Time: &amp;lt;/b&amp;gt;${ReadTime:DateFormat(datePattern: 'M/d/yyyy hh:mm:ss a', selector:'date')}"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that in the web map I'm getting the following value:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;6/17/2015 7:58:35 AM&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P&gt;So, the time is showing as 7 hours behind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a similar way I can set the UTC offset to 0, like when I used the PopupTemplate?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jun 2015 17:13:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-the-utc-offset-to-0-in-an-info-window/m-p/49237#M4325</guid>
      <dc:creator>IanBroad</dc:creator>
      <dc:date>2015-06-18T17:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the UTC offset to 0 in an Info Window?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-the-utc-offset-to-0-in-an-info-window/m-p/49238#M4326</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the date still being stored in the attribute field as a date value? If so, obtain the value, add (or subtract- I can't remember! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt;) 7 hours of seconds (25,200), create a new date object base on the corrected date value, and then format the new date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use a date formatting function with TooltipDialogs so it might be best to do that instead of trying to do it all in one line of code like your example above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function returnContent(attrib) {
&amp;nbsp; newDate = new Date(eval(attrib.ReadTime + 25200));
&amp;nbsp; outDate = &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;"&amp;lt;b&amp;gt;Read Time: &amp;lt;/b&amp;gt;" + &lt;/SPAN&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;DateFormat(datePattern: 'M/d/yyyy hh:mm:ss a', selector:'date');&lt;/SPAN&gt;

&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;&amp;nbsp; return outDate;&lt;/SPAN&gt;
&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using a tooltipDialog in one of my apps and the tooltip does show a date in the tooltip. I used a formatter function to adjust the date stored in the attribute field. The app is still in legacy coding but here's my snippit related to the tooltipDialog:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.showSnocoTooltip = function(evt) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theAttributes = evt.graphic.attributes;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theDate = new Date(eval(eval(evt.graphic.attributes.LASTOBS + 28800) * 1000));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theTime = formatTime(new Date(eval(eval(evt.graphic.attributes.LASTOBS + 28800) * 1000)));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theHeight = evt.graphic.attributes.READING;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theContent = returnGagePopupContent(theAttributes);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var snocoDialog = new dijit.TooltipDialog({id: "snocoTooltipDialog",content: theContent,style: "position: absolute; font: normal normal bold 8pt Tahoma;z-index:100;"});
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; snocoDialog.startup();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dijit.placeOnScreen(snocoDialog.domNode, {x: evt.pageX,y: evt.pageY}, ["TL", "BL"], {x: 5,y: 5});
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:53:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-the-utc-offset-to-0-in-an-info-window/m-p/49238#M4326</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2021-12-10T21:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the UTC offset to 0 in an Info Window?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-the-utc-offset-to-0-in-an-info-window/m-p/49239#M4327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Even though Date objects are created in local timezone, JavaScript allows reliable access to UTC hours/minutes/seconds (without hard-coding the local timezone differential)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wrapped Date creation like like this:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function createUTCDate() {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var l = new Date();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new Date(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDay(),l.getUTCHours(),l.getUTCMinutes(),l.getUTCSeconds(),0);
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but you could also format based on the same getters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:53:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-the-utc-offset-to-0-in-an-info-window/m-p/49239#M4327</guid>
      <dc:creator>VinceAngelo</dc:creator>
      <dc:date>2021-12-10T21:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to set the UTC offset to 0 in an Info Window?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-the-utc-offset-to-0-in-an-info-window/m-p/49240#M4328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would also add that the different browsers can treat the same JS date formatting code differently (I'm looking at you, IE)&amp;nbsp; so check your results in all browsers that your users may use with your application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For that reason, I use the &lt;A href="https://github.com/datejs/Datejs"&gt;date.js library&lt;/A&gt; for my date formatting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2015 14:55:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-the-utc-offset-to-0-in-an-info-window/m-p/49240#M4328</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2015-06-19T14:55:31Z</dc:date>
    </item>
  </channel>
</rss>

