<?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: Format Date in InfoTemplate in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208616#M19359</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The sample is in the Feature Layer folder and is called 'Format Info Window', here's the link again hopefully it'll work this time:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/EN/webapi/javascript/arcgis/demos/fl/fl_infowindow.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/EN/webapi/javascript/arcgis/demos/fl/fl_infowindow.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can't directly format the dates in the info window at this release, you have to listen for the layer's click event and format the contents of the info window there. At version 2.2 this will no longer be necessary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; dojo.connect(featureLayer, 'onClick', function(e) {

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*some of the values have a quote in the name - remove that then split the string

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to separate the common and scientific names. */

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var attr = e.graphic.attributes.qSpecies.replace('"', "").split("::");

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //if the common name isn't included display the scientific name instead. 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var commonName = dojo.string.trim((attr[1] === "") ? attr[0] : attr[1]);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //wikipedia uses the genus_species so build that value to append to wikipedia url 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var scientificName = dojo.string.substitute("${0}_${1}", attr[0].split(" "));

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //populate the info window

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.setTitle(e.graphic.attributes.qAddress);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.setContent("&amp;lt;b&amp;gt;" + commonName + "&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;a target='_blank' href=http://en.wikipedia.org/wiki/" + scientificName + "&amp;gt;Wikipedia Entry&amp;lt;/a&amp;gt;");

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.show(e.screenPoint, map.getInfoWindowAnchor(e.screenPoint));

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 10:18:11 GMT</pubDate>
    <dc:creator>KellyHutchins</dc:creator>
    <dc:date>2021-12-11T10:18:11Z</dc:date>
    <item>
      <title>Format Date in InfoTemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208612#M19355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to get a date from a column in my attribute table for a feature layer, yet I can only get a number version, does anyone know how I can easily convert this into a proper date? Or retrieve a date in the first place?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I am doing:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var wellContent = "&amp;lt;b&amp;gt;Well Name&amp;lt;/b&amp;gt;: ${NAME}&amp;lt;br&amp;gt;&amp;lt;b&amp;gt;Spud Date&amp;lt;/b&amp;gt;: ${SPUD}";&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is an example of what I am getting returned:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;636249600000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When the date in the attribute table is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;01/03/1990&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Sep 2010 14:48:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208612#M19355</guid>
      <dc:creator>BenSayers</dc:creator>
      <dc:date>2010-09-16T14:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Format Date in InfoTemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208613#M19356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Having the same issue....were you able to solve this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Dec 2010 17:18:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208613#M19356</guid>
      <dc:creator>PatKeegan</dc:creator>
      <dc:date>2010-12-27T17:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Format Date in InfoTemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208614#M19357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;At 2.2 we are making some changes to simplify this process but for now here's a sample that shows how to format the contents of an info window. This sample formats string values but could be modified to format numeric or date values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/EN/webapi/jav...nfowindow.html"&gt;http://help.arcgis.com/EN/webapi/jav...nfowindow.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; For date formatting you can use dojo.date.locale.format, the 'Page through records in a table' sample uses this to format date values:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/fl_paging.html"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/fl_paging.html&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Dec 2010 15:21:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208614#M19357</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2010-12-28T15:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Format Date in InfoTemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208615#M19358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Kelly,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The 1st link did not work and I was not able to determine which example you were referencing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I could not embed dojo.date.locale.format in the infoTemplate....any advice?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; infoTemplate = new esri.InfoTemplate();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; infoTemplate.setTitle("Information");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; infoTemplate.setContent("&amp;lt;b&amp;gt;Incident Type: &amp;lt;/b&amp;gt;${IncidentCategory}&amp;lt;hr&amp;gt;"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; + "&amp;lt;b&amp;gt;Date: &amp;lt;/b&amp;gt;${DATE_}&amp;lt;br/&amp;gt;"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; + "&amp;lt;b&amp;gt;Location: &amp;lt;/b&amp;gt;${LOCATION}&amp;lt;br/&amp;gt;"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; + "&amp;lt;b&amp;gt;Description: &amp;lt;/b&amp;gt;${PROBLEM}&amp;lt;br/&amp;gt;"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; + "&amp;lt;b&amp;gt;Incident ID: &amp;lt;/b&amp;gt;${CASE__}");&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.resize(245,125);&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Dec 2010 16:43:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208615#M19358</guid>
      <dc:creator>PatKeegan</dc:creator>
      <dc:date>2010-12-30T16:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Format Date in InfoTemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208616#M19359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The sample is in the Feature Layer folder and is called 'Format Info Window', here's the link again hopefully it'll work this time:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/EN/webapi/javascript/arcgis/demos/fl/fl_infowindow.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/EN/webapi/javascript/arcgis/demos/fl/fl_infowindow.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can't directly format the dates in the info window at this release, you have to listen for the layer's click event and format the contents of the info window there. At version 2.2 this will no longer be necessary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; dojo.connect(featureLayer, 'onClick', function(e) {

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*some of the values have a quote in the name - remove that then split the string

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; to separate the common and scientific names. */

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var attr = e.graphic.attributes.qSpecies.replace('"', "").split("::");

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //if the common name isn't included display the scientific name instead. 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var commonName = dojo.string.trim((attr[1] === "") ? attr[0] : attr[1]);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //wikipedia uses the genus_species so build that value to append to wikipedia url 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var scientificName = dojo.string.substitute("${0}_${1}", attr[0].split(" "));

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //populate the info window

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.setTitle(e.graphic.attributes.qAddress);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.setContent("&amp;lt;b&amp;gt;" + commonName + "&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;a target='_blank' href=http://en.wikipedia.org/wiki/" + scientificName + "&amp;gt;Wikipedia Entry&amp;lt;/a&amp;gt;");

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.show(e.screenPoint, map.getInfoWindowAnchor(e.screenPoint));

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:18:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208616#M19359</guid>
      <dc:creator>KellyHutchins</dc:creator>
      <dc:date>2021-12-11T10:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Format Date in InfoTemplate</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208617#M19360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Kelly,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There's some help associated with the new date format functionality available since 2.2&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/intro_formatinfowindow.htm"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/intro_formatinfowindow.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;... but what's not clear is whether or not a feature layer is required (rather than just a ArcGISDynamicMapServiceLayer).&amp;nbsp; All of the samples I've found that use the new formating options reference feature layers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a bunch of old code that uses querytasks/graphics to display the attributes in the infowindow which has been broken since the REST date/time format changed at AGS 10.&amp;nbsp; I've tried udating my JSAPI version to 2.7, and adding the formating info (i.e. "${EVENT_DATE:DateString}", "${EVENT_DATE:DateFormat}", etc.) with no luck.&amp;nbsp; I'm wondering if I need to recode everything to use feature layers to get the date working again...?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2012 20:45:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/format-date-in-infotemplate/m-p/208617#M19360</guid>
      <dc:creator>DanMcCoy</dc:creator>
      <dc:date>2012-03-19T20:45:57Z</dc:date>
    </item>
  </channel>
</rss>

