HOW TO

Reformat the ArcGIS Survey123 date and time questions in an email notification designed in Microsoft Power Automate and Integromat

Last Published: November 5, 2020

Summary

When designing a flow using the 'Send an email when a survey response is submitted on Survey123' template in Microsoft Power Automate, or a scenario using the 'Send an email via Office 365 Email when a survey is submitted' template in Integromat, it is possible to insert the attributes from survey responses using dynamic fields. These values can be used in different components of the flow or scenario, such as in an email Subject or Body. However, by default, the date and time attributes are displayed as a string of numbers in the email. For instance, 8/17/2020, 1:30 PM displays as 1597644000000.

Image showing the date and time question in ArcGIS Survey123.

The images below show the notifications for survey responses sent in the email by Microsoft Power Automate and Integromat.

Microsoft Power Automate integration and ArcGIS Survey123.
Integromat and ArcGIS Survey123 integration.

This is by design. ArcGIS Survey123 stores date and time in Epoch time (also known as Unix time) as the default time zone. Epoch time is the amount of time in seconds that has elapsed since January 1, 1970 (00:00:00 UTC).

This article provides steps to reformat the ArcGIS Survey123 date and time survey responses.

Procedure

In Microsoft Power Automate

  1. Add a 'Convert time zone' action.
    1. Under When a survey response is submitted, click the add button, and click Add an action.
    2. In the Choose an action window, search forĀ 'Convert time zone'.
    3. Click the Actions tab, and click Convert time zone.
Image showing the convert time zone action.
  1. Convert the default time zone to the intended time zone.
    1. In the Convert time zone window, click the Base time box. In the pop-up window on the right, click the Expression tab. Search for and select addSeconds(timestamp, seconds, format?).
    2. Insert the following function in the addSeconds() expression. Ensure the survey's date/time field is inserted in the <Date_Time_field> component of the expression.
addSeconds('1970-1-1', Div(triggerBody()?['feature']?['attributes']?['<Date_Time_field>'],1000))
  1. Click OK.
addSeconds expression.
  1. In the Source time zone section, select (UTC) Coordinated Universal Time.
  2. In the Destination time zone section, select the time zone required. In this example, the time zone is (UTC-05:00) Eastern Time (US & Canada).
  3. In the Format string section, select a format for the converted time. In this example, Full date/time pattern (long time) - Monday, June 15, 2009 1:45:30 PM [F] is selected.
Image showing the convert time zone action.
  1. Use the converted date/time format in the email. In the Send an email window, click the box next to the Body section. In the pop-up window on the right, click the Dynamic content tab, and select Converted time.
Image showing the send an email component.
  1. Click Save to save the changes.

The following image shows the survey response notification by Microsoft Power Automate in an email with the reformatted date and time question.

Image showing the email notification using MS Power Automate.

In Integromat

The following workflow describes steps to insert the necessary components to the formatDate(date; format; [timezone]) expression.

  1. In the Microsoft 365 Email window, click the Body content box, and a window menu displays on the right. Add the formatDate expression.
Image showing the Add the formatDate expression.
formatDate expression.
  1. For the 'date' component of the formatDate() expression, add the addSeconds expression, and insert the necessary components according to the addSeconds(date; number) format.
Image showing the Add the addSeconds expression.
Image showing the addSeconds expression.
  1. For the 'date' component, insert 1970-1-1T00:00:00.000Z.
  2. For the 'number' component, insert the date/time attribute from the Survey123 - Watch window, the / operator from the Math functions window, and 1000.
Image showing the Survey123 - Watch section.
Math functions window.
  1. For the 'format' component of the formatDate() expression, insert YYYY-MM-DD hh:mm A.
  2. For the '[timezone]' component of the formatDate() expression, insert the required time zone. In this example, the time zone is US/Eastern.

The image below shows the necessary components inserted to the formatDate(date; format; [timezone]) expression.

Image showing the Body content of the email.

The following image shows the survey response notification by Integromat in an email with the reformatted date and time question.

Image showing the Email notification using Integromat.

Article ID:000023954

Software:
  • ArcGIS Survey123 Field App iOS

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic