<?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 Using Arcade to change string field to a date field in Dashboard in ArcGIS GeoEvent Server Questions</title>
    <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/using-arcade-to-change-string-field-to-a-date/m-p/1376663#M4086</link>
    <description>&lt;P&gt;We have 2 webservices pulling data into GeoEvent from our SQL databases. The issue is that the format of the Date field coming from SQL isn't in a time format that is recognized by GeoEvent.&amp;nbsp; The field needs to be parsed from a string into a date field in order to then use Date functions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The format is (Day of Week in 3 letters, DD-MM-YYYY hh:mm:ss TZD)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ThomasRickett_0-1706725463092.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/93342iA88356B97A45A8D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ThomasRickett_0-1706725463092.png" alt="ThomasRickett_0-1706725463092.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How do I do that? So I can then use date functions to go from GMT to CST?&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jan 2024 18:32:06 GMT</pubDate>
    <dc:creator>ThomasRickett</dc:creator>
    <dc:date>2024-01-31T18:32:06Z</dc:date>
    <item>
      <title>Using Arcade to change string field to a date field in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/using-arcade-to-change-string-field-to-a-date/m-p/1376663#M4086</link>
      <description>&lt;P&gt;We have 2 webservices pulling data into GeoEvent from our SQL databases. The issue is that the format of the Date field coming from SQL isn't in a time format that is recognized by GeoEvent.&amp;nbsp; The field needs to be parsed from a string into a date field in order to then use Date functions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The format is (Day of Week in 3 letters, DD-MM-YYYY hh:mm:ss TZD)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ThomasRickett_0-1706725463092.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/93342iA88356B97A45A8D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ThomasRickett_0-1706725463092.png" alt="ThomasRickett_0-1706725463092.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How do I do that? So I can then use date functions to go from GMT to CST?&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 18:32:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/using-arcade-to-change-string-field-to-a-date/m-p/1376663#M4086</guid>
      <dc:creator>ThomasRickett</dc:creator>
      <dc:date>2024-01-31T18:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to change string field to a date field in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/using-arcade-to-change-string-field-to-a-date/m-p/1376704#M4087</link>
      <description>&lt;P&gt;With a consistent format, you can do this with &lt;STRONG&gt;Split&lt;/STRONG&gt;. That will get your string into is component parts, which you can reference by index.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var date_parts = Split('Wed, 16 Nov 2022 21:14:10 GMT', ' ')

var the_day = date_parts[1] // '16'
var the_month = date_parts[2] // 'Nov'
var the_year = date_parts[3]  // '2022'
var the_time = date_parts[4] // '21:14:10'
var the_tz = date_parts[5] // 'GMT'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Building a date from that is easy enough, though the month and time need more work.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var time_parts = split(the_time, ':')

var the_hour = time_parts[0] // '21'
var the_minute = time_parts[1] // '14'
var the_second = time_parts[2] // '10'

// Convert month string to numeric equivalent; months are 0-indexed
var month_number = Decode(
  the_month,
  'Jan', 0,
  'Feb', 1,
  'Mar', 2,
  'Apr', 3,
  'May', 4,
  'Jun', 5,
  'Jul', 6,
  'Aug', 7,
  'Sep', 8,
  'Oct', 9,
  'Nov', 10,
  'Dec', 11,
  0
)

// create a date; convert each to number
var gmt_date = Date(
  Number(the_year),
  month_number,
  Number(the_day),
  Number(the_hour),
  Number(the_minute),
  Number(the_second),
  'Etc/GMT'
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're sure that everything's coming in from GMT and going out as CST, you can use &lt;STRONG&gt;ChangeTimeZone&lt;/STRONG&gt;.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var cst_date = ChangeTimeZone(gmt_date, 'US/Central')&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 31 Jan 2024 19:12:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/using-arcade-to-change-string-field-to-a-date/m-p/1376704#M4087</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-01-31T19:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to change string field to a date field in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/using-arcade-to-change-string-field-to-a-date/m-p/1378462#M4109</link>
      <description>&lt;P&gt;We have been trying to get this to work but we are running into 2 errors. We are getting back a null field value when we test it in our dashboard. Either I don't understand how to return things, or I don't know where to put in the field I want to change which is (bcs_Response_Date) . Also, I don't have the function to Change Time Zone.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image (15).png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/93792i1FF331ED814405EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="image (15).png" alt="image (15).png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 22:16:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/using-arcade-to-change-string-field-to-a-date/m-p/1378462#M4109</guid>
      <dc:creator>ThomasRickett</dc:creator>
      <dc:date>2024-02-05T22:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using Arcade to change string field to a date field in Dashboard</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/using-arcade-to-change-string-field-to-a-date/m-p/1378465#M4110</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Invalid Function" style="width: 811px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/93793i05B65146EEEEE581/image-size/large?v=v2&amp;amp;px=999" role="button" title="image (16).png" alt="Invalid Function" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Invalid Function&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 22:17:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/using-arcade-to-change-string-field-to-a-date/m-p/1378465#M4110</guid>
      <dc:creator>ThomasRickett</dc:creator>
      <dc:date>2024-02-05T22:17:48Z</dc:date>
    </item>
  </channel>
</rss>

