Esri / Esri/arcgis-python-api

Add option to return python datetime object with timezone like Search cursor rather than Timestamp

未关闭
#2,467 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement under consideration
主要语言
Python
星标
2.2k
派生
1.2k
平均合并
2 小时 40 分钟
30 天内合并 PR
2

描述

**Is your feature request related to a problem? Please describe.**
Access Hosted Feature layer on 11.5. the datetime fields is returned as a python datetime object via arcpy.da.searchcursor. However, via the api on the same feature I get a time stamp, so I have to convert to compare. Please make the option to return dates as datetime objects wiht timezone info. Also seems like the timestamp adds 1 micro second, I have to trim of the microsecond as well to comare. the data the HFS was created from has no micro seconds, might be a float issue on converting to a timestamp adding a mircosecond

```python
#SC
(datetime.datetime(2026, 2, 2, 18, 37, 24, 1)
#feature.attributes.get(field)
1770057444000
```

**Describe the solution you'd like**
Add an option or key word something like the below. Just seem like it should default to do that as this is python and datetimes are the preferred option in pythong over timestamp and this change woudl match the currect search cursor. I assume there is a part of the code converting it to a timestamp.
Example.
target_features = fl.query(out_fields=query_fields, return_geometry=True, Dates_as_datetime = True)

**Describe alternatives you've considered**
current work around it to convert it to a datetime object, whihc seems unecessary.

**Additional context**
Add any other context or screenshots about the feature request here.

贡献指南

打开贡献指南

调研方向

Start at the FeatureLayer query entry point shown as fl.query, then trace how date fields become timestamps. Define how the requested datetime option should preserve timezone information and avoid the reported microsecond change. Done means query results can return timezone-aware Python datetime objects while existing behavior remains available.

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api, data
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。