Converting Date to Text

796
2
Jump to solution
07-31-2023 11:27 AM
Chris_Anderson
Occasional Contributor II

I am new to Arcade and am using it to convert a dateTime to a text field inside QuickCapture. The text field should be "MM/DD/YYYY" (no number padding). To do so, I have tried both of the following equations: 

"${arcadeExpression: Concatenate([text(Month($feature.Survey_Date_Time),M),text(Day($feature.Survey_Date_Time),D),text(Year($feature.Survey_Date_Time),Y)],'/')}"

"${arcadeExpression:var month = Text(Month($feature.Survey_Date_Time));var day = Text(Day($feature.Survey_Date_Time));var year = Text(Year($feature.Survey_Date_Time));var date = Concatenate([month,day,year],'/');return date;}"

 

Unfortunately, I keep getting "NaN/NaN/NaN". I tried to use the Text() function to change the result of the Month(), Day(), and Year() results from integer to text, but it does not appear to be the issue.

Any help you can provide is greatly appreciated.

Chris Anderson

1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

The Text function is the easiest way to convert a Date to a text field.

return Text(Now(), "MM/DD/YYYY")

text.png

View solution in original post

0 Kudos
2 Replies
KenBuja
MVP Esteemed Contributor

The Text function is the easiest way to convert a Date to a text field.

return Text(Now(), "MM/DD/YYYY")

text.png

0 Kudos
Chris_Anderson
Occasional Contributor II

Thanks! That worked. I was thinking I had to go the Excel route to do the calculation.

0 Kudos