Hi,
I would like to copy data hosted in an AGOL layer to a map service hosted layer in my Enterprise Portal. The structures of these 2 layers are identical.
This data includes a date field which is stored in AGOL in UTC.
From ArcGIS Pro, I shared the destination layer as a web layer to my Enterprise Portal. So an ArcGIS Server service was published. In the parameters of this ArcGis Server service, date field parameter is set to UTC time zone.
However when I use the python function "featurelayer.edit_features(adds)" to copy my data from AGOL to the PORTAL, on arrival my date fields have been converted to local time (UTC - 2).
Whatever the place from which I query them (from the Portal directly or from ArcGis Pro or even from a Python script), the values of my date fields have lost 2 hours.
I ask for your help to understand how to succeed in copying my data while keeping them in UTC.
Thanks for your help
I am also struggling with this issue. At the moment, my solution is after new features are added, use an update cursor on the date fields to convert them using pytz, tzinfo. You can also use the datetime package timedelta module in the update cursor. Not ideal, since it requires editing to be enabled on the Portal item, but so it is...
Hello EmmaHatcher,
Thanks for sharing your experience. Indeed, the solution you propose solves the problem. However, I still do not understand where this time zone adjustment comes from when it is not requested. I contacted ESRI support who don't understand either... A date type data should normally be copied by the Python function in UTC without modification.