HOW TO
The instructions provided in this article describe the steps to populate a date field using values from a text field using Arcade expression in ArcGIS Online. The example applies the date format 'YYYY/MM/DD, Local Time'.

> Add Field.

var date_text = $feature.IntakeDate //replace this parameter with the desired field
function Convert2Date(date_text){
var months = {"01": 0, "02": 1, "03": 2, "04": 3, "05": 4, "06": 5, "07": 6, "08": 7, "09": 8, "10": 9, "11": 10, "12": 11};
var date_list = Split(date_text, '/')
var yearNum = Number(date_list[0]);
var monthNum = months[date_list[1]];
var dayNum = Number(date_list[2]);
return Date(yearNum,monthNum,dayNum);
}
return ToLocal(Convert2date(date_text));

The image below shows the new date field, LocalDate, is populated.

Article ID: 000026844
Get help from ArcGIS experts
Start chatting now