Hi Community,
No question, just a tip to share...
For a workflow we have to check for new observations in an ArcGIS Online Feature Service and send an email to relevant stakeholders. AGOL time is in UTC whereas the email is send in local time. To notify the right times we had to convert the AGOL time to local time and the email time to UTC. We use AttributeCreators for that. Below we share the code used for these conversions:
# Convert input time (in UTC) to local time
#
# Author: Egge-Jan Pollé, Tensing GIS Consultancy B.V.
# Date: 24 October 2018
#
# The date we get from ArcGIS Online (SRNL_CREATED_DATE) is in UTC.
# To convert it to local time we first have to set the time zone to utc:
#
# Step 1: @TimeZoneSet(@Value(SRNL_CREATED_DATE),utc)
#
# Next we can convert it form utc to local:
#
# Step 2: @TimeZoneSet(<Output from Step 1>,local,convert)
#
# We can nest this like below:
@TimeZoneSet(@TimeZoneSet(@Value(SRNL_CREATED_DATE),utc),local,convert)
# Convert input time (in local time) to UTC
#
# Author: Egge-Jan Pollé, Tensing GIS Consultancy B.V.
# Date: 24 October 2018
#
# The date we get with @DateTimeNow() is in local time.
# To convert it to UTC first we have to set the time zone to local:
#
# Step 1: @TimeZoneSet(@DateTimeNow(),local)
#
# Next we can convert it form local to utc:
#
# Step 2: @TimeZoneSet(<Output from Step 1>,utc,convert)
#
# We can nest this like below:
@TimeZoneSet(@TimeZoneSet(@DateTimeNow(),local),utc,convert)