Select to view content in your preferred language

Dynamic current date text

1864
7
10-19-2023 08:28 AM
Labels (1)
PatrickHanley1
New Contributor

Hello, 

I am trying to display a dynamic date in Experience builder in a text string. I need to label a page CURRENTYEAR+1 through CURRENTYEAR+4

I am seeing posts about doing this through the embedded content widget and HTML, but I also found ESRI documentation that they are no longer supporting <string> HTML functions which is what they suggest to get dynamic date

Any ideas?

7 Replies
ShengdiZhang
Esri Regular Contributor

Hi @PatrickHanley1 ,

You can try using an Expression in the Text widget to add dynamic content.

ShengdiZhang_0-1697768545913.png

Hope it helps,

Shengedi

0 Kudos
PatrickHanley1
New Contributor

Hi Shengedi, 

Unfortunately I dont think that will work, I believe the dynamic content in a text widget only works when referencing a layer. I am not trying to reference any layer, just need a dynamic date of the current year

0 Kudos
TimConfare2
Regular Contributor

I need to do the same.  Have you ever found a solution to this?  Thanks

 

0 Kudos
KrystalPhaneuf4
Occasional Contributor

@PatrickHanley1  and @TimConfare2 I am also trying to do this. Any solutions?

0 Kudos
TimConfare2
Regular Contributor

I ended up creating a html file with code for the current date and then embedding it where the text would be.  Let me know if you need any more info. 

0 Kudos
TobyGrant2
New Contributor

Add a Text widget. Connect to data (any data, it doesn't matter as it won't be used) than select 'Arcade' in the widget popup menu (click on widget on map) and in the 'return' part of the code update value to read value: Year(Now())      This will display the current year.

 

0 Kudos
TobyGrant2
New Contributor

Use Text(Year(Now()),"#") to remove the thousands separator

0 Kudos