I noticed something weird when messing with the geospatial python's shapefile module (no complaints here, this module is awesome and the only pure python way to write shapefiles).
When adding date fields, the values appear to be written in the table correctly, but when I view them in any ArcGIS application, the dates appear wrong. Using this simple code, I am adding a new date:
import shapefile from datetime import datetime test = r'C:\TEMP\Date_test3.shp' w = shapefile.Writer(1) w.point(-93.1, 44.1) w.field('Date', 'D') # todays date, but appears in table as 12/8/2014....Weird? today = datetime(2015, 8, 7) #hard coded so the example is always the same w.records = [[today]] w.save(test)
When I view it in ArcGIS, it looks wrong:
I have also tried to input this as a string with no luck. However, the value that is stored is correct. When I read the shapefile:
# however, when I read it, it is indeed the correct value in the database r = shapefile.Reader(test) print r.records() >>> 2015-08-07 00:00:00 >>>
Is there a different way I should be passing in dates for the shapefile module? Is this a bug specific to ArcGIS, or is something funky happening with the way shapefile is encoding the data. I also opened up the .dbf in Excel, and it appears correct there too (I suppose this might indicate a bug with ArcGIS). Does anyone know what may be going on here?
I am using ArcGIS 10.3.