<?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 Arcade Dashboard Dateadd function for a $datapoint List in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-dashboard-dateadd-function-for-a-datapoint/m-p/1242743#M7132</link>
    <description>&lt;P&gt;I am trying to convert 3 $datapoint. streams from UTC to CST.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value [$datapoint.bcs_time_first_unit_assigned] comes in as a string in the form of [&lt;SPAN&gt;Mon, 19 Dec 2022 22:37:59 GMT], Day, Date, Month, Year, Hour, Minutes, Seconds.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Looking at other similar threads I think I need to convert that string to a useable date value and then add the 6 hours to it. Or I've tried using the Now() command to just render the time into the local endpoint user time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I have this, but its not returning anything useful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;var dateInitial = $datapoint.bcs_time_first_unit_assigned;&lt;BR /&gt;$datapoint.bcs_time_first_unit_arrived;&lt;BR /&gt;$datapoint.bcs_response_time_depart&lt;/P&gt;&lt;P&gt;// convert to date&lt;BR /&gt;var dateval = Date(&lt;BR /&gt;Left(dateInitial, 4),&lt;BR /&gt;Mid(dateInitial, 4, 2),&lt;BR /&gt;Mid(dateInitial, 6, 2)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;var dateParse = Text(dateval, 'MM/DD/YYYY')&lt;BR /&gt;&lt;BR /&gt;return dateParse&lt;BR /&gt;&lt;BR /&gt;function GMTtoCST(dateParse){&lt;BR /&gt;return DateAdd(dateParse, -6, 'hours')&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var d1 = Now()&lt;BR /&gt;var d2 = Date('2022', '5', '27', '15')&lt;BR /&gt;var d3 = Date('2017', '8', '11', '8')&lt;/P&gt;&lt;P&gt;Console(d1, GMTtoCST(d1))&lt;BR /&gt;Console(d2, GMTtoCST(d2))&lt;BR /&gt;Console(d3, GMTtoCST(d3))&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;return {&lt;BR /&gt;textColor: '',&lt;BR /&gt;backgroundColor: '',&lt;BR /&gt;separatorColor:'',&lt;BR /&gt;selectionColor: '',&lt;BR /&gt;selectionTextColor: '',&lt;BR /&gt;attributes: {&lt;BR /&gt;assigned: GMTtoCST($datapoint.bcs_time_first_unit_assigned),&lt;BR /&gt;arrived: GMTtoCST($datapoint.bcs_time_first_unit_arrived),&lt;BR /&gt;departed: GMTtoCST($datapoint.bcs_response_time_depart)&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ThomasRickett_0-1671556555180.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/58976i836F6B1B99CBFFF6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ThomasRickett_0-1671556555180.png" alt="ThomasRickett_0-1671556555180.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you and I appreciate any help you can give.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Dec 2022 17:24:52 GMT</pubDate>
    <dc:creator>ThomasRickett</dc:creator>
    <dc:date>2022-12-20T17:24:52Z</dc:date>
    <item>
      <title>Arcade Dashboard Dateadd function for a $datapoint List</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-dashboard-dateadd-function-for-a-datapoint/m-p/1242743#M7132</link>
      <description>&lt;P&gt;I am trying to convert 3 $datapoint. streams from UTC to CST.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value [$datapoint.bcs_time_first_unit_assigned] comes in as a string in the form of [&lt;SPAN&gt;Mon, 19 Dec 2022 22:37:59 GMT], Day, Date, Month, Year, Hour, Minutes, Seconds.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Looking at other similar threads I think I need to convert that string to a useable date value and then add the 6 hours to it. Or I've tried using the Now() command to just render the time into the local endpoint user time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I have this, but its not returning anything useful.&amp;nbsp;&lt;/P&gt;&lt;P&gt;var dateInitial = $datapoint.bcs_time_first_unit_assigned;&lt;BR /&gt;$datapoint.bcs_time_first_unit_arrived;&lt;BR /&gt;$datapoint.bcs_response_time_depart&lt;/P&gt;&lt;P&gt;// convert to date&lt;BR /&gt;var dateval = Date(&lt;BR /&gt;Left(dateInitial, 4),&lt;BR /&gt;Mid(dateInitial, 4, 2),&lt;BR /&gt;Mid(dateInitial, 6, 2)&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;var dateParse = Text(dateval, 'MM/DD/YYYY')&lt;BR /&gt;&lt;BR /&gt;return dateParse&lt;BR /&gt;&lt;BR /&gt;function GMTtoCST(dateParse){&lt;BR /&gt;return DateAdd(dateParse, -6, 'hours')&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var d1 = Now()&lt;BR /&gt;var d2 = Date('2022', '5', '27', '15')&lt;BR /&gt;var d3 = Date('2017', '8', '11', '8')&lt;/P&gt;&lt;P&gt;Console(d1, GMTtoCST(d1))&lt;BR /&gt;Console(d2, GMTtoCST(d2))&lt;BR /&gt;Console(d3, GMTtoCST(d3))&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;return {&lt;BR /&gt;textColor: '',&lt;BR /&gt;backgroundColor: '',&lt;BR /&gt;separatorColor:'',&lt;BR /&gt;selectionColor: '',&lt;BR /&gt;selectionTextColor: '',&lt;BR /&gt;attributes: {&lt;BR /&gt;assigned: GMTtoCST($datapoint.bcs_time_first_unit_assigned),&lt;BR /&gt;arrived: GMTtoCST($datapoint.bcs_time_first_unit_arrived),&lt;BR /&gt;departed: GMTtoCST($datapoint.bcs_response_time_depart)&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ThomasRickett_0-1671556555180.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/58976i836F6B1B99CBFFF6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ThomasRickett_0-1671556555180.png" alt="ThomasRickett_0-1671556555180.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you and I appreciate any help you can give.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 17:24:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/arcade-dashboard-dateadd-function-for-a-datapoint/m-p/1242743#M7132</guid>
      <dc:creator>ThomasRickett</dc:creator>
      <dc:date>2022-12-20T17:24:52Z</dc:date>
    </item>
  </channel>
</rss>

