Extracting hour from a Date Field in ArcGIS Online

868
2
05-13-2018 01:25 PM
AndrewHansford
Occasional Contributor II

Hi there,

I have a date field that is captured in New Zealand Standard and Daylight Savings Time when using Survey123. When I go to calculate this data in ArcGIS Online to extract the Hour component from the date. It is returning the wrong hour.

for example if the data was collected at 6am it returns the actual hour as 6pm or 7pm (Daylight savings time). Has anyone experienced this in AGOL.

Thanks 

Andrew

2 Replies
ClaireProctor
Occasional Contributor

Hi Andrew,

You can do this within Survey123 rather than ArcGIS Online, by using the format_date function. Formatting your date in an additional field will format it while filling out the survey, meaning that you'll get your correct system time. Something like the sample used in the Date Formatting section of this doc page should work: Formulas

format-date(${previous_time},'%H:%M')

This one will give you an hour and minute display, which won't change in ArcGIS Online, if put into a text field.

AndrewHansford
Occasional Contributor II

Hi Claire Proctor‌,

Thanks for the quick reply , I implemented your above solution on my new field called "Hour" for reporting purposes. However, the issue is that it is only going to populate based on the previous question on new records and not the existing records. So the dilemma at present is the need to calculate the existing records.

Also what is odd in Survey123 it shows the date/time in NZST or NZDT, but in ArcGIS Pro it shows it in UTC. I would have thought that the Date Format would be consistent between applications.

It is some odd functionality that I am experiencing.

Thanks

Andrew

0 Kudos