<?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: Need to convert a string to a date in GeoEvent in ArcGIS GeoEvent Server Questions</title>
    <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/need-to-convert-a-string-to-a-date-in-geoevent/m-p/379452#M1599</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Adam!&amp;nbsp; I just figured out another way to do it in GeoEvent.&amp;nbsp; First, I used a Field Calculator in GeoEvent to combine the date and time fields (Date + ' ' + Time) and output the result as a string.&amp;nbsp; Then I used another Field Calculator to replace all the dashes in the date field (replaceAll(Date,'-','/')).&amp;nbsp; I created a new date field while also creating a new definition that had a date/time field.&amp;nbsp; Finally I used Field Mapper to map this newly created date/time field from the new definition in a new feature layer.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Jul 2019 19:24:40 GMT</pubDate>
    <dc:creator>ISP_graynic</dc:creator>
    <dc:date>2019-07-18T19:24:40Z</dc:date>
    <item>
      <title>Need to convert a string to a date in GeoEvent</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/need-to-convert-a-string-to-a-date-in-geoevent/m-p/379450#M1597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a feature layer that has the date/time in two separate &lt;STRONG&gt;string&amp;nbsp;&lt;/STRONG&gt;fields labeled "Date" and "Time".&amp;nbsp; I need to convert these into a &lt;STRONG&gt;date&lt;/STRONG&gt; field using GeoEvent.&amp;nbsp; I created a second feature service that has a DateTime field that is a date field however I am having trouble getting GeoEvent to copy the string date over into the second feature layer as a date.&amp;nbsp; Any help is appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2019 21:19:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/need-to-convert-a-string-to-a-date-in-geoevent/m-p/379450#M1597</guid>
      <dc:creator>ISP_graynic</dc:creator>
      <dc:date>2019-07-15T21:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Need to convert a string to a date in GeoEvent</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/need-to-convert-a-string-to-a-date-in-geoevent/m-p/379451#M1598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/42722"&gt;Nicholas Gray&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Have you tried calculating the two string fields (date and time)&amp;nbsp;into one ISO 8601 compliant string into&amp;nbsp;a new field?&amp;nbsp; I don't know how your original date and time strings look.&amp;nbsp; You may have to do a bunch of &lt;EM&gt;substring()&lt;/EM&gt; function calculations&amp;nbsp;to pull out pieces of everything, like Year, Month, Day, Hour, Minute, Second, Millisecond and put them into their own string fields - and then calculate them all together into one compliant "DateTime" string.&amp;nbsp; Depending what time zone your data stream sends it's date and time in, you will probably have to add it to the string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example,&amp;nbsp;if&amp;nbsp;DateField value&amp;nbsp;=&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;07/18/2019&lt;/EM&gt; &lt;/STRONG&gt;and TimeField value = &lt;STRONG&gt;&lt;EM&gt;1630&lt;/EM&gt;&lt;/STRONG&gt; , you would have to pull out all of the elements of both date and time given and place them into new string fields using &lt;A href="https://enterprise.arcgis.com/en/geoevent/latest/process-event-data/field-calculator-processor.htm#GUID-E2178E7D-A378-4E87-A250-2E57282AC5E6"&gt;Substring Field Calculations in GeoEvent&lt;/A&gt;.&amp;nbsp; &lt;EM&gt;(In this case I am assuming that your date data always has 2 characters in Month and Day with leading zeros)&lt;/EM&gt;:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Year&lt;/EM&gt;: &lt;STRONG&gt;2019&lt;/STRONG&gt; - calculated into "year" field with expression &lt;STRONG&gt;substring(DateField,6,-1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Month&lt;/EM&gt;: &lt;STRONG&gt;07&lt;/STRONG&gt;&amp;nbsp;- from&amp;nbsp;&lt;STRONG&gt;substring(DateField,0,2&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Day&lt;/EM&gt;: &lt;STRONG&gt;18&lt;/STRONG&gt; - from &lt;STRONG&gt;substring(DateField,3,5&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Hour&lt;/EM&gt;: &lt;STRONG&gt;16&lt;/STRONG&gt; - from&amp;nbsp;&lt;STRONG&gt;substring(TimeField,0,2&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Minute&lt;/EM&gt;: &lt;STRONG&gt;30&lt;/STRONG&gt; - from &lt;STRONG&gt;substring(TimeField,2,-1&lt;/STRONG&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then the calculation to concatenate everything back into another string field &lt;EM&gt;ISODate&lt;/EM&gt;:&lt;/P&gt;&lt;P&gt;Expression:&amp;nbsp; &lt;EM&gt;Year&lt;/EM&gt; + '-' +&lt;EM&gt; Month&lt;/EM&gt; + '-' +&lt;EM&gt; Day&lt;/EM&gt; + 'T' + &lt;EM&gt;Hour &lt;/EM&gt;+ ':' +&lt;EM&gt; Minute &lt;/EM&gt;+ ':00+00:00'&lt;/P&gt;&lt;P&gt;Result:&amp;nbsp; &lt;STRONG&gt;2019-07-18T16:30:00+00:00&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(This is assuming that the feed is sending date/time in GMT&amp;nbsp; - change the +00:00 to whatever your time zone is if the time is local - mine would be -04:00)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That would be the first step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could then just use a "Push JSON to an External Websocket" output to push the &lt;EM&gt;ISODate &lt;/EM&gt;string into a "Receive JSON on a Websocket" input, with the field definition for the "DateTime" field set to &lt;SPAN style="text-decoration: underline;"&gt;Type&lt;/SPAN&gt;: &lt;EM&gt;Date.&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;From here, you could process anything else you need and then push to a Feature Service with a DateTime field defined as Date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A very good &lt;A _jive_internal="true" href="https://community.esri.com/community/gis/enterprise-gis/geoevent/blog/2019/03/14/what-time-is-it-well-that-depends"&gt;Blog Post&lt;/A&gt; to view too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Adam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2019 18:04:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/need-to-convert-a-string-to-a-date-in-geoevent/m-p/379451#M1598</guid>
      <dc:creator>AdamRepsher</dc:creator>
      <dc:date>2019-07-18T18:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Need to convert a string to a date in GeoEvent</title>
      <link>https://community.esri.com/t5/arcgis-geoevent-server-questions/need-to-convert-a-string-to-a-date-in-geoevent/m-p/379452#M1599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Adam!&amp;nbsp; I just figured out another way to do it in GeoEvent.&amp;nbsp; First, I used a Field Calculator in GeoEvent to combine the date and time fields (Date + ' ' + Time) and output the result as a string.&amp;nbsp; Then I used another Field Calculator to replace all the dashes in the date field (replaceAll(Date,'-','/')).&amp;nbsp; I created a new date field while also creating a new definition that had a date/time field.&amp;nbsp; Finally I used Field Mapper to map this newly created date/time field from the new definition in a new feature layer.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Jul 2019 19:24:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geoevent-server-questions/need-to-convert-a-string-to-a-date-in-geoevent/m-p/379452#M1599</guid>
      <dc:creator>ISP_graynic</dc:creator>
      <dc:date>2019-07-18T19:24:40Z</dc:date>
    </item>
  </channel>
</rss>

