0

So my dataset has two columns, Date (type Date) and Time (type Text) as shown in the screenshot below. Now, I would like to merge the two together and then create a new date column using the "Add Date Attributes" tool. This new column will then be provided to the "Create Space Time Cube From Defined Locations (two points)" tool showing the change in values with respect to time.

How can I merge these two columns and create a proper date column in ArcGIS Pro that can be used in "Create Space Time Cube From Defined Locations (two points)"?

enter image description here

1
  • 2
    Looking at ArcGIS field data types ArcGIS Pro | Documentation, there is no time-only data type. The ArcGIS Date data type is a date-time type. What back-end data source (shape file, geodatabase feature class, text table, etc...) are you using and what data type is the Time field.
    – bixb0012
    Commented Mar 28, 2023 at 16:59

1 Answer 1

1

Try this code with the Calculate Field function where the output field is of type date: enter image description here

Here is the code:

var rec_time = $feature.survey_time;
var str_len = count(rec_time);

IIF(str_len ==7,rec_time = concatenate('0',rec_time),0);

var isAM = IIF(right(rec_time,2)=='AM',true,false);
var hours = ceil(left(rec_time,2),0);
var minutes = ceil(mid(rec_time,3,2),0);

IIF ((isAM==false) && (hours !=12),hours=hours+12, 0);
IIF ((isAM) && (hours ==12),hours=0, 0);

var hours_in_minutes = hours * 60;

var total_minutes = hours_in_minutes+minutes;
dateadd($feature.survey_date,total_minutes,'minutes');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.