Importing data from Excel and maintaining the time format
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.
I found the following method to work (after many attempts of trial and error).
I stored my data in an excel spreadsheet (v. 2010) for convenience and ease of editing. Format the column that contains the time data as "General". Enter the current date (for example today is 02/11/2012
) followed by your specified time. So, each cell should contain something like 02/11/201209:00:00
(without any spaces).
I then saved the spreadsheet as a .csv and imported it into ArcMap. Display the XY coordinates as usual then export the data as .shp file.
The time field should now read exactly as it does in the excel spreadsheet, and function in a logical way.