Select to view content in your preferred language

ExB Dynamic Content Expression for Date field

195
8
a week ago
Labels (1)
StephenKing3
Frequent Contributor

Hello,

Is it possible to create an expression for a date field so that only the date is shown rather than date and time?

I am using a date field to populate a text box, at the moment pulling in an attribute {date} and it formats as 21/11/2025, 00:00 - I just want to show the date 21/11/2025. I know that you can use an Expression instead, but I'm not sure if it's possible to format the date field in that Expression, or how to do it.

Thanks!

0 Kudos
8 Replies
ZenMasterZeke
Frequent Contributor

Are you using the newer date only field type? The widget you use for display can also affect formatting.

Anyway, to format using Arcade, use the Text function:

Text($feature.your_date_field, "dd/MM/yyyy")

 

StephenKing3
Frequent Contributor

I've tried adding that function into the expression box but it doesn't accept it. Is this the correct place to put it?

Thanks!

StephenKing3_1-1767796530927.png

 

 

0 Kudos
ZenMasterZeke
Frequent Contributor

Hmmm...

0 Kudos
StephenKing3
Frequent Contributor

Maybe this is a difference in versions of ExB. Sorry, I should have said that I'm using the Enterprise 11.5 version, not the latest.

0 Kudos
NicoleJohnson
MVP

@StephenKing3, if you don't need the time somewhere else and the layer is housed in a web map, you can just change the "show time" setting for that field in Map Viewer:

NicoleJohnson_1-1767809658921.png

I actually can't get the time to display at all though (in 11.5), so I'm curious what the difference is between our setups. Text widget vs the table widget:

NicoleJohnson_2-1767810325135.png

The time does however seem to display automatically in ArcGIS Online:

NicoleJohnson_3-1767810497851.png

If you do have access to AGOL, you can format with Arcade by clicking the "</>" icon (next to the "dynamic content" cylinder). The exact code would depend on whether you're selecting something and then showing the date, etc. but it's there that you could use the Text function. The functions offered in the expression window are pretty limited (things like minimum, maximum, etc.).

 

StephenKing3
Frequent Contributor

My setup is pulling in data from a feature layer generated from a Survey123 survey form. I'm not trying to display any features in the map from this, just pulling in tabular data. Thanks for the pointer to the 'show time' setting for the feature layer. You can change this for the layer visualisation and save it, but it doesn't appear to make any difference in pulling in the data field in ExB.

NicoleJohnson
MVP

Ah man, that's frustrating. For anyone who happens to see this and is working in ArcGIS Online, changing that setting in Map Viewer does work to stop the time from displaying. Maybe it's a bug? I found something that seems related, found in 11.4: "The ArcGIS Experience Builder Table widget fails to hide the time for a date field when 'Show time' is disabled on that field, and the list of fields for the widget is customized." BUG-000174261 for ArcGIS Experience Builder

StephenKing3
Frequent Contributor

Thank you, that's useful to know!

0 Kudos