Hi I've got a web map used in Collector and a popup configured to send an email to a distribution group when a link is selected from the web map. A Power Automate flow runs and sends the email. What I'm having trouble with is getting a date field to display a human readable date in the email. Inside Power Automate I tried to use a Compose step to first format the date field coming from dynamic content with a "formatdatetime(triggerBody()?['feature']?['attributes']?['FIELD'],'yyyy-MM-dd')" and this just about gets it but not quite. Power Automate gives me the following error:
“Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2849': 'The template language function 'formatdatetime' expects its first parameter to be of type string. The provided value is of type 'Integer'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.”
I tried to convert the integer date to a string without much luck, but maybe my syntax is wrong. Getting the date to display sure seems like it should be easier. Any ideas what I am missing?
Solved! Go to Solution.
Date and DateTime questions from Survey123 are exposed in Microsoft Automate using the UNIX epoch format. If you want to convert UNIX time into a readable date string, use the addseconds function. For example:
addseconds('1970-1-1', Div(triggerBody()?['feature']?['attributes']?['mydate'],1000) , 'yyyy-MM-dd')
Date and DateTime questions from Survey123 are exposed in Microsoft Automate using the UNIX epoch format. If you want to convert UNIX time into a readable date string, use the addseconds function. For example:
addseconds('1970-1-1', Div(triggerBody()?['feature']?['attributes']?['mydate'],1000) , 'yyyy-MM-dd')
That was it Ismael. Thank you for the assist!
@IsmaelChivite , I got this to work but I am off by 4 hours. Is there a time zone conversion that needs to be included? I am on EST. Thanks!