Date error using feature set save

06-05-2019 12:34 PM
New Contributor III

We are using a hosted feature layer that contains dates prior to 1900. I am using the ArcGIS Python API to save a queried feature set ( ) from this layer to a local geodatabase for analysis. All dates prior to the year 1900 are incorrect in the locally saved feature class. All other dates are saved with their correct UTC time. Using the Export Data option from the hosted feature layer using AGOL returns the correct results. Has anyone else experienced this, or know if this is a bug?

1 Reply
New Contributor III

Hey Adam, this is David -- We talked at UC2019 this year. Can you help me in giving some reproducible code? I tried to reproduce this morning but was unable to. This is what I did -- notice the `date` field has a value of 1899-10-06T23:56:15.040Z. Was this how your time was formatted?

    import pandas as pd
    from arcgis.features import Feature, FeatureSet

    before_feature = Feature.from_dict({"geometry": {"x": -146.49779999999998, "y": 68.87620000000004, "spatialReference": {"wkid": 4326, "latestWkid": 4326}}, "attributes": {"OBJECTID": 1, "date": "1899-10-06T23:56:15.040Z", "depth": 4.5, "depthError": 0.2, "dmin": "", "gap": "", "horizontalError": "", "id": "ak16328849", "latitude": 68.8762, "locationSource": "ak", "longitude": -146.4978, "mag": 2.5, "magError": "", "magNst": "", "magSource": "ak", "magType": "ml", "net": "ak", "nst": "", "place": "92km NNW of Arctic Village, Alaska", "rms": 0.49, "status": "reviewed", "time": "00:11:44.917Z", "type": "earthquake", "updated": "2017-10-06T23:56:15.040Z"}})
    before_featureset = FeatureSet([before_feature,])"in_memory", "test1234")
    after_featureset = pd.DataFrame.spatial.from_featureclass(r"in_memory\test1234").spatial.to_featureset()
0 Kudos