Good morning,
date fields when I read a recorrd froma hosted layer in AGOL have nummeric values:
this is the value for this field: "created_date": 1719488318485
Python:
record = query_result1.features[0]
createddateAGOL = record.attributes["created_date"]
How do I convert this numeric value to a data that I can compare with a record from a SDE feature class
Thanks
Solved! Go to Solution.
Use this to convert to a date/time object:
from datetime import datetime as dt
created_date = record.attributes["created_date"]
my_dt = dt.utcfromtimestamp(created_date / 1000)
From there, there are various date/time formatting options:
https://docs.python.org/3/library/datetime.html#format-codes
Use this to convert to a date/time object:
from datetime import datetime as dt
created_date = record.attributes["created_date"]
my_dt = dt.utcfromtimestamp(created_date / 1000)
From there, there are various date/time formatting options:
https://docs.python.org/3/library/datetime.html#format-codes
Thank you @MobiusSnake
How do I store a datetme object value in a date field from a hosted feature layer?
I am updating the value of a date field in a hosted feature layer using Python.
Thanks
You can pass a date/time value directly into a method like edit_features or you can pass a timestamp in the same format that the query returned it in.