[GIS] Importing data from Excel and maintaining the time format

arcgis-10.0importshapefiletime

I am trying to import a file from Excel which is a GPS data set of consecutive points at 15 minute intervals. When I import the file and save it as a shapefile the time column is not read properly and GIS converts to 00:00:00 and then further down the column shifts to 01/01/1900.

I have tried to format the column in Excel as either hh:mm, hh:mm:ss, dd/mm/yyyy hh:mm or no number format and each has the same end result. The imported table shows the correct times but as soon as the data table is converted to a shapefile to be displayed the time format is lost.

I have never noticeably had this problem when importing data previously and I did not need to format the time. Now it seems that no formatting method will work properly.

How can I format the time column to retain the time values when imported and saved as a shapefile?

Best Answer

The reason that you are not able to save Time related information in a shapefile is that the Shapefile format, does not support Time as an attribute. They only support Date fields. This is due to the fact that the shapefile uses an older specification of the dBase file (.dbf) to store the attribute table.

If you need to store time data, you are going to have to use one of the ESRI Geodatabase formats, either the Personal GDB, or the File GDB, for local storage. Even with these formats, there are limitations on how well Time attribute fields are supported. This ESRI Help article discusses SQL query expressions, but also mentions what storage types support Time Attributes: SQL Reference for query expressions used in ArcGIS

Edit - To directly address your question of how to maintain your Time data.

When you save data as a specific time format, for example, 12:30:05 PM, this is stored, according to the SQL link above, as 1899-12-30 12:30:05. This is why you are seeing a conversion in the time between Excel and the shapefile.

If you have been able to do this in the past, what was likely occurring, was that the cells containing your time data were not actually formatted as "Date/Time" in Excel, therefore, when converted to Shapefile, there was no conversion of the times, and they were saved to a String field.

If you want to convert Time data from Excel, and store it in a shapefile, you will need to save it to a Text field. This Help article discusses Supported Field formats, and discusses storing date/time as both a string or a number.

This next article discusses Converting string or numeric time values into date format

These articles should provide you with some workarounds if you have to maintain your data in the Shapefile format.

Related Question