Select to view content in your preferred language

ArcPro Convert Time Field Tool

2347
5
05-21-2019 08:41 AM
DuaneTreadon
Regular Contributor

Hi all,

I am working with ArcPro (2.3.2) and the Crime Analysis tool set.  I am trying to use the Convert Time Field tool.  I am able to convert a date only (as text) field into a date field with the date, however I am having difficulty converting a text field with time in to a time (date field).

I have tried to combine the text field type date field and the time and then use the tool to convert so that I have a new date/time field. 

Example  Incident_D and Incident_T are both text field type one with the date and one with the incident time.  When combined into a new text field called INCD_DT the data is like this:  ‘1/3/2019 00:54’ and the like.

 

When using the convert time field tool  I set up my Time Format as M/d/yyyy HH:mm  With this, my output is just the date, no time carried over. 

 

I’ve tried different versions of the time format but nothing seems to bring the time into the field. 

 

Any ideas on how I need to set up my date time fields so that it will work and convert the ‘text’ field types into a ‘date’ field type that shows date and time for an incident?

0 Kudos
5 Replies
DanPatterson_Retired
MVP Emeritus

That wouldn't be a shapefile would it?

Geoprocessing considerations for shapefile output—Appendices | ArcGIS Desktop 

….. and they cannot store time in a date field.

addendum

and if it is a gdb featureclass table, the field has to be long enough or time gets truncated

https://pro.arcgis.com/en/pro-app/tool-reference/data-management/convert-time-field.htm

If the data type of the output time field isn't long enough to store the converted time value, the output value will be truncated.

0 Kudos
DuaneTreadon
Regular Contributor

Hi Dan,

Thanks for your reply.

It is a shapefile and I did see a post about shapefiles not working so I tried the tool on the original excel table that I brought into ArcPro.  It would not let me run the tool.  I get a Convert Time Field Failed error message.  I just now tried it again, but receive the same error on working with the table instead of a shapefile. 

What is that about a virtual table?  I brought in the original excel.

Message:

ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Underlying DBMS error[virtual tables may not be altered]
Failed to execute (ConvertTimeField).

0 Kudos
KoryKramer
Esri Community Moderator

Note that ArcGIS Pro cannot write to an Excel table.  And that tool adds a column and writes into it, thus altering the same input table.  As such, I guess an Excel table really shouldn't be supported input...

0 Kudos
DuaneTreadon
Regular Contributor

Kory,

Thanks.  That explains that part of the puzzle.  

So has anyone had success in setting up their data import so that the 'Select by Time of Day' tool within the Crime Analysis tool set works?  

I have no issues in setting up the data for using the 'Select by Date', Select by Day of Week', Select by Month' or 'Select by Year' tools under the Select by Date and Time tool.  I just cannot figure out how to set up my data so that I can use incident time as well.  

As an example of what I want to select is any reported incident on any Friday from 1600hrs to 2200hrs.  

Thanks all for your information and assistance. 

0 Kudos
DuaneTreadon
Regular Contributor

Just to help explain further, here is a screen capture from sample ESRI data used in one of the web training courses for the Crime Analysis tool (course deals with selection of crimes).

As you can see in the attribute table (from the 'Crimes' shapefile) there are fields with the time and date.  In checking flied properties (screen capture also included) these fields are listed as date fields.  Not text or numerical fields, but 'Date' fields.

I'm trying to figure out how they got their date field to work as a date field. 

Crimes .shp date time field

Crime .shp field propertiesPublic Safety‌