{"id":862551,"date":"2020-05-20T07:40:05","date_gmt":"2020-05-20T14:40:05","guid":{"rendered":"https:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=862551"},"modified":"2024-11-01T00:17:55","modified_gmt":"2024-11-01T07:17:55","slug":"displaying-time-spans-with-arcade-in-dashboards","status":"publish","type":"blog","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards","title":{"rendered":"Displaying time spans with Arcade in dashboards"},"author":10072,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"_searchwp_excluded":""},"categories":[777102,37121],"tags":[32551,25521,30111,661121,661111],"industry":[],"product":[36591,36671],"class_list":["post-862551","blog","type-blog","status-publish","format-standard","hentry","category-arcade","category-real-time","tag-arcade","tag-dashboards","tag-data-visualization","tag-dates","tag-time-spans","product-apps","product-ops-dashboard"],"acf":{"short_description":"Learn how to leverage Arcade to calculate time spans in your dashboard's list elements with ArcGIS Dashboards.","flexible_content":[{"acf_fc_layout":"content","content":"<p><span data-contrast=\"auto\">Dashboards are often used to monitor situ<\/span><span data-contrast=\"auto\">ations or events and use the real-time information provided to make decisions. The time component of an event can sometimes be a defining factor of what decisions are made.\u00a0<\/span><span data-contrast=\"auto\">A time<\/span><span data-contrast=\"auto\">stamp is useful for showing when something occurred \u2013 but when it comes to showing elapsed time, it\u2019s not the easie<\/span><span data-contrast=\"auto\">st<\/span><span data-contrast=\"auto\">\u00a0or quickest solution.\u00a0<\/span><span data-contrast=\"auto\">If you have a line item in a list displaying<\/span><span data-contrast=\"auto\">\u00a0the time an incident came in, you\u2019re getting only one half of the information you need<\/span><span data-contrast=\"auto\">. Showing e<\/span><span data-contrast=\"auto\">lapsed time is\u00a0<\/span><span data-contrast=\"auto\">useful for communicating things like<\/span><span data-contrast=\"auto\">:<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">How long ago\u00a0<\/span><span data-contrast=\"auto\">an event occurred.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-aria-posinset=\"2\" data-aria-level=\"1\"><span data-contrast=\"auto\">How long it t<\/span><span data-contrast=\"auto\">ook<\/span><span data-contrast=\"auto\">\u00a0to complete a\u00a0<\/span><span data-contrast=\"auto\">task<\/span><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">Which events are\u00a0<\/span><span data-contrast=\"auto\">new<\/span><span data-contrast=\"auto\">.<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"3\" data-aria-posinset=\"3\" data-aria-level=\"1\"><span data-contrast=\"auto\">Which requests have\u00a0<\/span><span data-contrast=\"auto\">been open for more\u00a0<\/span><span data-contrast=\"auto\">than<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">3\u00a0days.<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span data-contrast=\"auto\">Using<\/span><span data-contrast=\"auto\">\u00a0an Arcade expression<\/span><span data-contrast=\"auto\">, we can answer these questions by calculating<\/span><span data-contrast=\"auto\">\u00a0time spans\u00a0<\/span><span data-contrast=\"auto\">and display them<\/span><span data-contrast=\"auto\">\u00a0on a\u00a0<\/span><span data-contrast=\"auto\">list\u00a0<\/span><span data-contrast=\"auto\">element<\/span><span data-contrast=\"auto\">\u00a0or indicator element<\/span><span data-contrast=\"auto\">. Let\u2019s look at an\u00a0<\/span><a href=\"https:\/\/www.arcgis.com\/apps\/dashboards\/ace423ce4dc34f11b75662262a39a3c8\"><span data-contrast=\"none\">example dashboard<\/span><\/a><span data-contrast=\"auto\">\u00a0with this technique being used.\u00a0<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n"},{"acf_fc_layout":"image","image":{"ID":862521,"id":862521,"title":"fire incident dashboard","filename":"fire-incident-dashboard.jpg","filesize":177122,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/05\/fire-incident-dashboard.jpg","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards\/fire-incident-dashboard","alt":"Fire incidents dashboard","author":"10072","description":"","caption":"","name":"fire-incident-dashboard","status":"inherit","uploaded_to":862551,"date":"2020-05-14 18:52:12","modified":"2021-04-14 12:04:59","menu_order":0,"mime_type":"image\/jpeg","type":"image","subtype":"jpeg","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":1913,"height":896,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/05\/fire-incident-dashboard-213x200.jpg","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/05\/fire-incident-dashboard.jpg","medium-width":464,"medium-height":217,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/05\/fire-incident-dashboard.jpg","medium_large-width":768,"medium_large-height":360,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/05\/fire-incident-dashboard.jpg","large-width":1913,"large-height":896,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/05\/fire-incident-dashboard-1536x719.jpg","1536x1536-width":1536,"1536x1536-height":719,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/05\/fire-incident-dashboard.jpg","2048x2048-width":1913,"2048x2048-height":896,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/05\/fire-incident-dashboard-826x387.jpg","card_image-width":826,"card_image-height":387,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/05\/fire-incident-dashboard.jpg","wide_image-width":1913,"wide_image-height":896}},"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p><span data-contrast=\"auto\">This dashboard is being used to monitor emergency calls as they come in and their status (active and cleared).\u00a0<\/span><span data-contrast=\"auto\">The list on the left shows open incident<\/span><span data-contrast=\"auto\">s<\/span><span data-contrast=\"auto\"> and the time that has elapsed since they were opened while the list on the right show<\/span><span data-contrast=\"auto\">s<\/span><span data-contrast=\"auto\">\u00a0cleared incidents and how long each one took to clear (the response time).<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">This elapsed time information is not a field in the dataset but\u00a0<\/span><span data-contrast=\"auto\">rather<\/span><span data-contrast=\"auto\">\u00a0a calculation in an Arcade expression with a little bit of formatting<\/span><span data-contrast=\"auto\">. Here\u2019s how it was done.\u00a0<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<h2><span data-contrast=\"none\">Calculating time spans<\/span><span data-ccp-props=\"{&quot;335559738&quot;:240}\">\u00a0<\/span><\/h2>\n<p><span data-contrast=\"auto\">There are\u00a0two time<\/span><span data-contrast=\"auto\">\u00a0span calculations<\/span><span data-contrast=\"auto\">, one in each\u00a0<\/span><span data-contrast=\"auto\">list. The first\u00a0<\/span><span data-contrast=\"auto\">ca<\/span><span data-contrast=\"auto\">lculate<\/span><span data-contrast=\"auto\">s<\/span><span data-contrast=\"auto\">\u00a0how long it has been since an incident has been opened while the other calculate<\/span><span data-contrast=\"auto\">s<\/span><span data-contrast=\"auto\">\u00a0how long it took between being opened to being marked as c<\/span><span data-contrast=\"auto\">leared<\/span><span data-contrast=\"auto\">.\u00a0<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The following expression calculates how many seconds the incident has been opened.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n"},{"acf_fc_layout":"content","content":"<p><code><span data-contrast=\"none\">var\u00a0dateOpened\u00a0= $datapoint[\"Incident_Date\"];<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><br \/>\n<span data-contrast=\"none\">var\u00a0currentTime\u00a0=\u00a0Now();<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><br \/>\n<span data-contrast=\"none\">var\u00a0secondsOpen\u00a0=\u00a0DateDiff(currentTime,\u00a0dateOpened, 'seconds');<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/code><\/p>\n<p><span data-contrast=\"auto\">In the expression, we\u2019re taking the field that has the date and time the incident was opened<\/span><span data-contrast=\"auto\">\u00a0(<\/span><span data-contrast=\"auto\"><code>dateOpened<\/code><\/span><span data-contrast=\"auto\">)<\/span><span data-contrast=\"auto\">\u00a0and doing a date<\/span><span data-contrast=\"auto\">\u00a0difference calculation between when it was opened and the current time (<\/span><span data-contrast=\"auto\"><code>Now()<\/code><\/span><span data-contrast=\"auto\">)<\/span><span data-contrast=\"auto\">\u00a0to get the difference in seconds.\u00a0<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\"><strong>Tip:<\/strong> Since this expression for elapsed time takes in the current time (<\/span><span data-contrast=\"auto\"><code>Now()<\/code><\/span><span data-contrast=\"auto\">), it\u2019s a good idea to enable a script refresh to update the expression at the set interval, independent of the layer\u2019s refresh interval.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The next expression calculates how many seconds<\/span><span data-contrast=\"auto\">\u00a0passed between when the incident was opened to when it was\u00a0<\/span><span data-contrast=\"auto\">cleared<\/span><span data-contrast=\"auto\">.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:240}\">\u00a0<\/span><\/p>\n<p><code><span data-contrast=\"none\">var\u00a0dateOpened\u00a0= $datapoint[\"Incident_Date\"];<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><br \/>\n<span data-contrast=\"none\">var\u00a0dateCleared\u00a0= $datapoint[\"Call_Cleared_Date\"];<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><br \/>\n<span data-contrast=\"none\">var\u00a0<\/span><span data-contrast=\"none\">secondsToRespond<\/span><span data-contrast=\"none\">\u00a0=\u00a0<\/span><span data-contrast=\"none\">DateDiff<\/span><span data-contrast=\"none\">(<\/span><span data-contrast=\"none\">dateCleared<\/span><span data-contrast=\"none\">,\u00a0<\/span><span data-contrast=\"none\">dateOpened<\/span><span data-contrast=\"none\">, 'seconds'<\/span><span data-contrast=\"none\">);<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/code><\/p>\n<p><span data-contrast=\"auto\">This time, instead of taking the difference between when the incident was opened (<code>dateOpened<\/code>) and the current time, we\u2019re taking the differe<\/span><span data-contrast=\"auto\">nce between when the incident was opened\u00a0<\/span><span data-contrast=\"auto\">and\u00a0<\/span><span data-contrast=\"auto\">when it was\u00a0<\/span><span data-contrast=\"auto\">cleared\u00a0<\/span><span data-contrast=\"auto\">(<\/span><span data-contrast=\"auto\"><code>dateCleared<\/code><\/span><span data-contrast=\"auto\">).<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n"},{"acf_fc_layout":"content","content":"<h2><span data-contrast=\"none\">Format your time span<\/span><span data-ccp-props=\"{&quot;335559738&quot;:240}\">\u00a0<\/span><\/h2>\n<p><span data-contrast=\"auto\">Now that we have the time spans\u00a0<\/span><span data-contrast=\"auto\">calculated we want to format them to be easier to read \u2013\u00a0<\/span><span data-contrast=\"auto\">32<\/span><span data-contrast=\"auto\">68<\/span><span data-contrast=\"auto\">8 seconds is not really a<\/span><span data-contrast=\"auto\">\u00a0useful\u00a0<\/span><span data-contrast=\"auto\">measure<\/span><span data-contrast=\"auto\">.\u00a0<\/span><span data-contrast=\"auto\">We can format the seconds to read either\u00a0<\/span><span data-contrast=\"auto\">using common short hands (1d, 1h, 1m, 1s), in a\u00a0<\/span><span data-contrast=\"auto\">clock format (<\/span><span data-contrast=\"auto\">hh<\/span><span data-contrast=\"auto\">:<\/span><span data-contrast=\"auto\">mm<\/span><span data-contrast=\"auto\">:<\/span><span data-contrast=\"auto\">ss<\/span><span data-contrast=\"auto\">)<\/span><span data-contrast=\"auto\">, or any other way you can think of.\u00a0<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The following function can be added to the Arcade expression<\/span><span data-contrast=\"auto\">s above to format\u00a0<\/span><span data-contrast=\"auto\">your time span<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">(remember to put your function before the rest of your expression)<\/span><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{&quot;335551550&quot;:1,&quot;335551620&quot;:1,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n"},{"acf_fc_layout":"sidebar","content":"","image_reference":false,"layout":"code_snippet","image_reference_figure":"","snippet":"function formatElapsedTime(numSeconds, type) {\r\n    if (IsEmpty(type)) { type = 1 };\r\n    numSeconds = Floor(Abs(numSeconds));\r\n    var numMinutes = Floor(numSeconds\/60,0);\r\n    var numHours = Floor(numSeconds\/(60*60),0);\r\n    var numDays = Floor(numSeconds\/(60*60*24),0);\r\n\r\n\/\/Type 1 will format the time to use short-hand labels\r\nif (type == 1) { \r\n        var elapsedTime = When( \r\n            numMinutes &lt; 1, numSeconds + &#039;s&#039;, \r\n            numHours &lt; 1, numMinutes + &#039;m&#039;, \r\n            numDays &lt; 1, numHours + &#039;h &#039;, \r\n            numDays + &#039;d &#039; \r\n            ); \r\n        return elapsedTime;  \r\n    } \r\n\r\n\/\/Type 2 will format the time to a clock-format (H:mm:ss)\r\nif (type == 2) { \r\n        var relativeDate = DateAdd(Date(0,0,0,0,0,0), numSeconds, &#039;seconds&#039;); \r\n        var elapsedTime = When( \r\n            numHours &lt; 1, Text(relativeDate,&#039;mm:ss&#039;), \r\n            numDays &lt; 1, Text(relativeDate,&#039;HH:mm:ss&#039;), \r\n            numDays + &#039; days &#039; + Text(relativeDate,&#039;HH:mm&#039;) \r\n            ); \r\n        return elapsedTime; \r\n    } \r\n} ","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<p>In the function, we\u2019re declaring a few things. The first, if no type is\u00a0specified, default to type 1 (short-hand). Second, we\u2019re saying that if\u00a0<code>numSeconds<\/code> is a negative number, turn it positive. Lastly, we are specifying the two formats (type 1 and type 2), so that we can choose the format when we call the function.<\/p>\n<p>After you\u2019ve added the function, you can call it using the elapsed\u00a0time we calculated before (<code>secondsOpen<\/code>\u00a0or\u00a0<code>secondsToRespond<\/code>)\u00a0along with the formatting type\u00a0and assign the result to\u00a0a new\u00a0variable.<\/p>\n<p><code>var\u00a0timeFormatted\u00a0=\u00a0formatElapsedTime(secondsOpen, 1)<\/code>\u00a0or<br \/>\n<code>var\u00a0timeFormatted\u00a0=\u00a0formatElapsedTime(secondsToRespond, 2)<\/code><\/p>\n<p>Your final expression will look like the following:<\/p>\n"},{"acf_fc_layout":"sidebar","content":"","image_reference":false,"layout":"code_snippet","image_reference_figure":"","snippet":"var dateOpened = $datapoint[\"Incident_Date\"];\r\nvar currentTime = Now();\r\nvar secondsOpen = DateDiff(currentTime, dateOpened, 'seconds');\r\n\r\nfunction formatElapsedTime(numSeconds, type) {\r\n    if (IsEmpty(type)) { type = 1 };\r\n    numSeconds = Floor(Abs(numSeconds));\r\n    var numMinutes = Floor(numSeconds\/60,0);\r\n    var numHours = Floor(numSeconds\/(60*60),0);\r\n    var numDays = Floor(numSeconds\/(60*60*24),0);\r\n\r\n    if (type == 1) {\r\n        var elapsedTime = When(\r\n            numMinutes &lt; 1, numSeconds + &#039;s&#039;,\r\n            numHours &lt; 1, numMinutes + &#039;m&#039;,\r\n            numDays &lt; 1, numHours + &#039;h &#039;,\r\n            numDays + &#039;d &#039;\r\n            );\r\n        return elapsedTime; \r\n    }\r\n    \r\n  if (type == 2) {\r\n        var relativeDate = DateAdd(Date(0,0,0,0,0,0), numSeconds, &#039;seconds&#039;);\r\n        var elapsedTime = When(\r\n            numHours &lt; 1, Text(relativeDate,&#039;mm:ss&#039;),\r\n            numDays &lt; 1, Text(relativeDate,&#039;H:mm:ss&#039;),\r\n            numDays + &#039; days &#039; + Text(relativeDate,&#039;H:mm&#039;)\r\n            );\r\n        return elapsedTime;\r\n    }\r\n}\r\n\r\nvar timeFormatted = formatElapsedTime(secondsOpen, 1);\r\n\r\nreturn {\r\n  textColor: &#039;&#039;,\r\n  backgroundColor: &#039;&#039;,\r\n  separatorColor:&#039;#1a1a1a&#039;,\r\n  selectionColor: &#039;#8a8a8a&#039;,\r\n  selectionTextColor: &#039;&#039;,\r\n  attributes: {\r\n    timeFormatted: timeFormatted\r\n  }\r\n}","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<p><span data-contrast=\"auto\">We can now take this <\/span><span data-contrast=\"auto\">attribute and reference it in the <\/span><b><span data-contrast=\"auto\">L<\/span><\/b><b><span data-contrast=\"auto\">ine\u00a0<\/span><\/b><b><span data-contrast=\"auto\">I<\/span><\/b><b><span data-contrast=\"auto\">tem\u00a0<\/span><\/b><b><span data-contrast=\"auto\">T<\/span><\/b><b><span data-contrast=\"auto\">emplate<\/span><\/b><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">below\u00a0<\/span><span data-contrast=\"auto\">for each list using the syntax {expression\/<\/span><span data-contrast=\"auto\">timeFormat<\/span><span data-contrast=\"auto\">ted<\/span><span data-contrast=\"auto\">}.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<h2><span data-contrast=\"none\">Summary<\/span><span data-ccp-props=\"{&quot;335559738&quot;:240}\">\u00a0<\/span><\/h2>\n<p><span data-contrast=\"auto\">Using Arcade expressions, we were able to calculate two different time spans,\u00a0<\/span><span data-contrast=\"auto\">how long ago an incident occurred and how long it took to\u00a0<\/span><span data-contrast=\"auto\">respond<\/span><span data-contrast=\"auto\">.<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">We were also able to format these t<\/span><span data-contrast=\"auto\">ime spans\u00a0<\/span><span data-contrast=\"auto\">to<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">make\u00a0<\/span><span data-contrast=\"auto\">the information easier to understand<\/span><span data-contrast=\"auto\">.\u00a0<\/span><span data-contrast=\"auto\">Seeing the elapsed time of events\u00a0<\/span><span data-contrast=\"auto\">at a glance<\/span><span data-contrast=\"auto\">\u00a0can help make more informed decisions \u2013 especially for events that are time sensitive.<\/span><span data-contrast=\"auto\">\u00a0In emergency management, convey<\/span><span data-contrast=\"auto\">ing information efficiently is crucial because every second counts.<\/span><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Open\u00a0<\/span><a href=\"https:\/\/www.arcgis.com\/apps\/dashboards\/ace423ce4dc34f11b75662262a39a3c8\"><span data-contrast=\"none\">this dashboard<\/span><\/a><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">to see this technique in use\u00a0<\/span><span data-contrast=\"auto\">or\u00a0<\/span><span data-contrast=\"auto\">make a\u00a0<\/span><a href=\"https:\/\/www.arcgis.com\/apps\/dashboards\/new#id=ace423ce4dc34f11b75662262a39a3c8\"><span data-contrast=\"none\">copy<\/span><\/a> <span data-contrast=\"auto\">to see the Arcade expressions and configurations use<\/span><span data-contrast=\"auto\">d. As always, we love to see how you leverage Arcade expressions in your own dashboards. If you can, share your innovative dashboards with #ArcGISDashboards<\/span><span data-contrast=\"auto\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">\u00a0<\/span><\/p>\n<p><span data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n"}],"authors":[{"ID":8482,"user_firstname":"David","user_lastname":"Nyenhuis","nickname":"Dave Nyenhuis","user_nicename":"dnyenhuis","display_name":"David Nyenhuis","user_email":"DNyenhuis@esri.com","user_url":"","user_registered":"2018-10-26 13:47:59","user_description":"David Nyenhuis is a senior product engineer on the ArcGIS Dashboards team, driven by a simple idea: the best data experiences speak instantly. He specializes in distilling complexity into clear visual signals\u2014whether through maps, bold metrics, charts, or gauges\u2014so insights surface without effort. His work is guided by a passion for helping users build dashboards that stay current, invite exploration, and feel as refined as they are effective.","user_avatar":"<img data-del=\"avatar\" src='https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2026\/03\/Profile-Picture-467x465.jpg' class='avatar pp-user-avatar avatar-96 photo ' height='96' width='96'\/>"},{"ID":10072,"user_firstname":"Noora","user_lastname":"Golabi","nickname":"ngolabi","user_nicename":"ngolabi","display_name":"Noora Golabi","user_email":"ngolabi@esri.com","user_url":"","user_registered":"2019-10-21 16:04:20","user_description":"Noora is a product writer with a background in Geography and GIS. Working from Ottawa, Canada, she focuses on writing documentation and creating resources for users. In her free time, she's often baking, exploring the outdoors, and spending time with her dog.","user_avatar":"<img data-del=\"avatar\" src='https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/12\/IMG_20190105_125214-e1577129433605-213x200.jpg' class='avatar pp-user-avatar avatar-96 photo ' height='96' width='96'\/>"}],"related_articles":[{"ID":832001,"post_author":"10072","post_date":"2020-04-23 08:25:26","post_date_gmt":"2020-04-23 15:25:26","post_content":"","post_title":"Communicating status with icons using Arcade in Dashboards","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"closed","post_password":"","post_name":"communicating-status-with-icons-in-the-arcgis-dashboards-beta","to_ping":"","pinged":"","post_modified":"2024-11-01 00:18:18","post_modified_gmt":"2024-11-01 07:18:18","post_content_filtered":"","post_parent":0,"guid":"https:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=832001","menu_order":0,"post_type":"blog","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":797531,"post_author":"8482","post_date":"2022-02-27 10:00:48","post_date_gmt":"2022-02-27 18:00:48","post_content":"","post_title":"Getting started with advanced formatting using Arcade in Dashboards","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"closed","post_password":"","post_name":"getting-started-with-arcade-in-arcgis-dashboards","to_ping":"","pinged":"","post_modified":"2024-11-01 00:01:30","post_modified_gmt":"2024-11-01 07:01:30","post_content_filtered":"","post_parent":0,"guid":"https:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=797531","menu_order":0,"post_type":"blog","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":838811,"post_author":"10072","post_date":"2020-04-29 08:30:25","post_date_gmt":"2020-04-29 15:30:25","post_content":"","post_title":"Conditional formatting in dashboard indicators with Arcade","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"closed","post_password":"","post_name":"conditional-formatting-indicators-with-arcade","to_ping":"","pinged":"","post_modified":"2024-11-01 00:18:06","post_modified_gmt":"2024-11-01 07:18:06","post_content_filtered":"","post_parent":0,"guid":"https:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=838811","menu_order":0,"post_type":"blog","post_mime_type":"","comment_count":"1","filter":"raw"}],"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/05\/timespans_card.jpg","wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/05\/timespans_banner.jpg"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Displaying time spans with Arcade in dashboards with ArcGIS Dashboards<\/title>\n<meta name=\"description\" content=\"Leverage Arcade in your dashboard lists to calculate and display time spans in an meaningful way. Format your time spans to represent your data effectively.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Displaying time spans with Arcade in dashboards\" \/>\n<meta property=\"og:description\" content=\"Leverage Arcade in your dashboard lists to calculate and display time spans in an meaningful way. Format your time spans to represent your data effectively.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards\" \/>\n<meta property=\"og:site_name\" content=\"ArcGIS Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/esrigis\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T07:17:55+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@ESRI\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards\"},\"author\":{\"name\":\"Noora Golabi\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/d6d26bb8da3387354ff0b0189d79f68d\"},\"headline\":\"Displaying time spans with Arcade in dashboards\",\"datePublished\":\"2020-05-20T14:40:05+00:00\",\"dateModified\":\"2024-11-01T07:17:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards\"},\"wordCount\":7,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"keywords\":[\"arcade\",\"dashboards\",\"data visualization\",\"dates\",\"time spans\"],\"articleSection\":[\"Arcade\",\"Real-Time Visualization &amp; Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards\",\"name\":\"Displaying time spans with Arcade in dashboards with ArcGIS Dashboards\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\"},\"datePublished\":\"2020-05-20T14:40:05+00:00\",\"dateModified\":\"2024-11-01T07:17:55+00:00\",\"description\":\"Leverage Arcade in your dashboard lists to calculate and display time spans in an meaningful way. Format your time spans to represent your data effectively.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.esri.com\/arcgis-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Displaying time spans with Arcade in dashboards\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"name\":\"ArcGIS Blog\",\"description\":\"Get insider info from Esri product teams\",\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\",\"name\":\"Esri\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"width\":400,\"height\":400,\"caption\":\"Esri\"},\"image\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/esrigis\/\",\"https:\/\/x.com\/ESRI\",\"https:\/\/www.linkedin.com\/company\/5311\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/d6d26bb8da3387354ff0b0189d79f68d\",\"name\":\"Noora Golabi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/12\/IMG_20190105_125214-e1577129433605-213x200.jpg\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/12\/IMG_20190105_125214-e1577129433605-213x200.jpg\",\"caption\":\"Noora Golabi\"},\"description\":\"Noora is a product writer with a background in Geography and GIS. Working from Ottawa, Canada, she focuses on writing documentation and creating resources for users. In her free time, she's often baking, exploring the outdoors, and spending time with her dog.\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/author\/ngolabi\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Displaying time spans with Arcade in dashboards with ArcGIS Dashboards","description":"Leverage Arcade in your dashboard lists to calculate and display time spans in an meaningful way. Format your time spans to represent your data effectively.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards","og_locale":"en_US","og_type":"article","og_title":"Displaying time spans with Arcade in dashboards","og_description":"Leverage Arcade in your dashboard lists to calculate and display time spans in an meaningful way. Format your time spans to represent your data effectively.","og_url":"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards","og_site_name":"ArcGIS Blog","article_publisher":"https:\/\/www.facebook.com\/esrigis\/","article_modified_time":"2024-11-01T07:17:55+00:00","twitter_card":"summary_large_image","twitter_site":"@ESRI","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards#article","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards"},"author":{"name":"Noora Golabi","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/d6d26bb8da3387354ff0b0189d79f68d"},"headline":"Displaying time spans with Arcade in dashboards","datePublished":"2020-05-20T14:40:05+00:00","dateModified":"2024-11-01T07:17:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards"},"wordCount":7,"commentCount":4,"publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"keywords":["arcade","dashboards","data visualization","dates","time spans"],"articleSection":["Arcade","Real-Time Visualization &amp; Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards","url":"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards","name":"Displaying time spans with Arcade in dashboards with ArcGIS Dashboards","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#website"},"datePublished":"2020-05-20T14:40:05+00:00","dateModified":"2024-11-01T07:17:55+00:00","description":"Leverage Arcade in your dashboard lists to calculate and display time spans in an meaningful way. Format your time spans to represent your data effectively.","breadcrumb":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.esri.com\/arcgis-blog\/"},{"@type":"ListItem","position":2,"name":"Displaying time spans with Arcade in dashboards"}]},{"@type":"WebSite","@id":"https:\/\/www.esri.com\/arcgis-blog\/#website","url":"https:\/\/www.esri.com\/arcgis-blog\/","name":"ArcGIS Blog","description":"Get insider info from Esri product teams","publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization","name":"Esri","url":"https:\/\/www.esri.com\/arcgis-blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","width":400,"height":400,"caption":"Esri"},"image":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/esrigis\/","https:\/\/x.com\/ESRI","https:\/\/www.linkedin.com\/company\/5311\/"]},{"@type":"Person","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/d6d26bb8da3387354ff0b0189d79f68d","name":"Noora Golabi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/12\/IMG_20190105_125214-e1577129433605-213x200.jpg","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2019\/12\/IMG_20190105_125214-e1577129433605-213x200.jpg","caption":"Noora Golabi"},"description":"Noora is a product writer with a background in Geography and GIS. Working from Ottawa, Canada, she focuses on writing documentation and creating resources for users. In her free time, she's often baking, exploring the outdoors, and spending time with her dog.","url":"https:\/\/www.esri.com\/arcgis-blog\/author\/ngolabi"}]}},"text_date":"May 20, 2020","author_name":"Multiple Authors","author_page":"https:\/\/www.esri.com\/arcgis-blog\/products\/ops-dashboard\/real-time\/displaying-time-spans-with-arcade-in-dashboards","custom_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/05\/timespans_banner.jpg","primary_product":"ArcGIS Dashboards","tag_data":[{"term_id":32551,"name":"arcade","slug":"arcade","term_group":0,"term_taxonomy_id":32551,"taxonomy":"post_tag","description":"","parent":0,"count":113,"filter":"raw"},{"term_id":25521,"name":"dashboards","slug":"dashboards","term_group":0,"term_taxonomy_id":25521,"taxonomy":"post_tag","description":"","parent":0,"count":39,"filter":"raw"},{"term_id":30111,"name":"data visualization","slug":"data-visualization","term_group":0,"term_taxonomy_id":30111,"taxonomy":"post_tag","description":"","parent":0,"count":97,"filter":"raw"},{"term_id":661121,"name":"dates","slug":"dates","term_group":0,"term_taxonomy_id":661121,"taxonomy":"post_tag","description":"","parent":0,"count":2,"filter":"raw"},{"term_id":661111,"name":"time spans","slug":"time-spans","term_group":0,"term_taxonomy_id":661111,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"}],"category_data":[{"term_id":777102,"name":"Arcade","slug":"arcade","term_group":0,"term_taxonomy_id":777102,"taxonomy":"category","description":"","parent":0,"count":98,"filter":"raw"},{"term_id":37121,"name":"Real-Time Visualization &amp; Analytics","slug":"real-time","term_group":0,"term_taxonomy_id":37121,"taxonomy":"category","description":"","parent":0,"count":166,"filter":"raw"}],"product_data":[{"term_id":36591,"name":"Apps","slug":"apps","term_group":0,"term_taxonomy_id":36591,"taxonomy":"product","description":"","parent":0,"count":648,"filter":"raw"},{"term_id":36671,"name":"ArcGIS Dashboards","slug":"ops-dashboard","term_group":0,"term_taxonomy_id":36671,"taxonomy":"product","description":"","parent":36591,"count":195,"filter":"raw"}],"primary_product_link":"https:\/\/www.esri.com\/arcgis-blog\/?s=#&products=ops-dashboard","_links":{"self":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/862551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/users\/10072"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/comments?post=862551"}],"version-history":[{"count":0,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/862551\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/media?parent=862551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/categories?post=862551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/tags?post=862551"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/industry?post=862551"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/product?post=862551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}