Converting time using Power Automate and Survey123

1707
2
Jump to solution
01-28-2021 06:14 AM
DaveK
by
Occasional Contributor

Hello! 

I'm using Power Automate to send a confirmation email when a survey is submitted. I have a dateTime field within my survey and I am interested in converting the time to be understandable within an email. As I understand it the survey contains the date/time in Epoch time. I found an article explaining how to perform this conversion but I seem to be doing something wrong, because the Power Automate process throws an error on my expression. 

Link to the conversion article - https://support.esri.com/en/technical-article/000023954

And here is my expression - 

addSeconds('1970-1-1', Div(triggerBody()?['feature']?['attributes']?['datetime'],1000))

 

If anyone has done this conversion before and has information it would be appreciated! 

Thanks. 

0 Kudos
1 Solution

Accepted Solutions
IsmaelChivite
Esri Notable Contributor

I think you are just missing the format string at the end.

  • In Power Automate, click on the body input box of your email action
  • Select Dynamic Content
  • Switch to the Expression tab
  • Type addSeconds('1970-1-1',Div(
  • Then insert the date value from the survey (switching momentarily to dynamic content to select your date question in the survey).
  • Your expression will look something like this: addSeconds('1970-1-1',Div(triggerBody()?['feature']?['attributes']?['yourdatequestion']
  • Now add ,1000),'yyyy-MM-dd')
  • Your final expression will be something like this

addSeconds('1970-1-1',Div(triggerBody()?['feature']?['attributes']?['yourdatequestion'] ,1000),'yyyy-MM-dd')

View solution in original post

2 Replies
IsmaelChivite
Esri Notable Contributor

I think you are just missing the format string at the end.

  • In Power Automate, click on the body input box of your email action
  • Select Dynamic Content
  • Switch to the Expression tab
  • Type addSeconds('1970-1-1',Div(
  • Then insert the date value from the survey (switching momentarily to dynamic content to select your date question in the survey).
  • Your expression will look something like this: addSeconds('1970-1-1',Div(triggerBody()?['feature']?['attributes']?['yourdatequestion']
  • Now add ,1000),'yyyy-MM-dd')
  • Your final expression will be something like this

addSeconds('1970-1-1',Div(triggerBody()?['feature']?['attributes']?['yourdatequestion'] ,1000),'yyyy-MM-dd')

Ursu_Lacramioara
New Contributor III

Hi Ismael @IsmaelChivite 

I used your logic for the Date/Time and I don't get the correct time in the email. I created a test record set to  Dec 25, 2021 @1pm and the email was generated for Date as Dec 24, 2021 @7pm. any suggestions? Thank you!

Lacri

0 Kudos