How to format the date from survey to display it as DD/MM/YYYY in Power Automate Reports

1143
4
Jump to solution
03-22-2023 06:38 AM
Paulvan_Heerden1
New Contributor III

Hi there

I have created several flows that generate reports in Power Automate, then save them on One Drive, and then email them to the person that submitted the survey. 

In the "Create Report" section, I am giving the report a unique name using fields from the survey. I want to add the date to the name as well, but am struggling to get the formatting right. I know that I have to use the formatDateTime() expression, but I am just not able to get the syntax correct. My date filed in my survey is called q1_3_assessmentdate. I have tried using the following but it isn't working:

formatDateTime(triggerOutputs()?['body/feature/attributes/q1_3_assessmentdate'];DDMMYYYY)
 
Paulvan_Heerden1_0-1679491790420.png

 

Previously, in Integromat, I used to format it like below:

Paulvan_Heerden1_0-1679492667341.png

 

Please could someone explain to me how i format the date properly. I am not interested in the time at all, just the date

Thanks so much

 

0 Kudos
2 Solutions

Accepted Solutions
MiltonSolano
Occasional Contributor

Hey @Paulvan_Heerden1 

You need to use a Compose data operation first in order to use the properly formatted date. Then use this formula in PA:

addseconds('1970-1-1', Div(triggerOutputs()?['body/feature/attributes/YOUR_DATE'],1000) , 'dd-MM-yyyy')

Here's how I did it:

Screenshot 2023-03-25 14.01.20.png

Fecha Seminario is the Compose data operation, and the formula is:

addseconds('1970-1-1', Div(triggerOutputs()?['body/feature/attributes/seminar_date'],1000) , 'dd-MM-yyyy')

Then, on the Send an email notification step, I used the output date from the compose operation. I hope this works for you.

Milton

View solution in original post

ZaraSheikh
New Contributor

@Paulvan_Heerden1 wrote:

Hi there

I have created several flows that generate reports in Power Automate, then save them on One Drive, and then email them to the person that submitted the survey. 

In the "Create Report" section, I am giving the report a unique name using fields from the survey. I want to add the date to the name https://accedii.com/ as well, but am struggling to get the formatting right. I know that I have to use the formatDateTime() expression, but I am just not able to get the syntax correct. My date filed in my survey is called q1_3_assessmentdate. I have tried using the following but it isn't working:

formatDateTime(triggerOutputs()?['body/feature/attributes/q1_3_assessmentdate'];DDMMYYYY)
 
Paulvan_Heerden1_0-1679491790420.png

 

Previously, in Integromat, I used to format it like below:

Paulvan_Heerden1_0-1679492667341.png

 

Please could someone explain to me how i format the date properly. I am not interested in the time at all, just the date

Thanks so much

 


Hello,

To format a date from a survey response to display it as DD/MM/YYYY in a Power Automate report, you can use the formatDateTime function in Power Automate. Here is an example of how to use it:

  1. Start by adding a "Parse JSON" action to your Power Automate flow. This action will parse the survey response and extract the date field that you want to format. Make sure to select the "Date" data type for the date field.

  2. Next, add a "Compose" action to your flow. This action will use the formatDateTime function to format the date in the desired format. In the "Inputs" field of the "Compose" action, enter the following expression:

formatDateTime(triggerBody()?['Date'], 'dd/MM/yyyy')

Replace "triggerBody()" with the name of the output from your "Parse JSON" action, and replace "Date" with the name of the field that contains the date you want to format.

  1. Finally, add the "Compose" action output to your report. You can do this by selecting the "Compose" action from the "Dynamic content" pane and choosing the "Formatted value" output.

With these steps, you should be able to format the date from the survey response to display it as DD/MM/YYYY in your Power Automate report.

View solution in original post

4 Replies
MiltonSolano
Occasional Contributor

Hey @Paulvan_Heerden1 

You need to use a Compose data operation first in order to use the properly formatted date. Then use this formula in PA:

addseconds('1970-1-1', Div(triggerOutputs()?['body/feature/attributes/YOUR_DATE'],1000) , 'dd-MM-yyyy')

Here's how I did it:

Screenshot 2023-03-25 14.01.20.png

Fecha Seminario is the Compose data operation, and the formula is:

addseconds('1970-1-1', Div(triggerOutputs()?['body/feature/attributes/seminar_date'],1000) , 'dd-MM-yyyy')

Then, on the Send an email notification step, I used the output date from the compose operation. I hope this works for you.

Milton

ZaraSheikh
New Contributor

@Paulvan_Heerden1 wrote:

Hi there

I have created several flows that generate reports in Power Automate, then save them on One Drive, and then email them to the person that submitted the survey. 

In the "Create Report" section, I am giving the report a unique name using fields from the survey. I want to add the date to the name https://accedii.com/ as well, but am struggling to get the formatting right. I know that I have to use the formatDateTime() expression, but I am just not able to get the syntax correct. My date filed in my survey is called q1_3_assessmentdate. I have tried using the following but it isn't working:

formatDateTime(triggerOutputs()?['body/feature/attributes/q1_3_assessmentdate'];DDMMYYYY)
 
Paulvan_Heerden1_0-1679491790420.png

 

Previously, in Integromat, I used to format it like below:

Paulvan_Heerden1_0-1679492667341.png

 

Please could someone explain to me how i format the date properly. I am not interested in the time at all, just the date

Thanks so much

 


Hello,

To format a date from a survey response to display it as DD/MM/YYYY in a Power Automate report, you can use the formatDateTime function in Power Automate. Here is an example of how to use it:

  1. Start by adding a "Parse JSON" action to your Power Automate flow. This action will parse the survey response and extract the date field that you want to format. Make sure to select the "Date" data type for the date field.

  2. Next, add a "Compose" action to your flow. This action will use the formatDateTime function to format the date in the desired format. In the "Inputs" field of the "Compose" action, enter the following expression:

formatDateTime(triggerBody()?['Date'], 'dd/MM/yyyy')

Replace "triggerBody()" with the name of the output from your "Parse JSON" action, and replace "Date" with the name of the field that contains the date you want to format.

  1. Finally, add the "Compose" action output to your report. You can do this by selecting the "Compose" action from the "Dynamic content" pane and choosing the "Formatted value" output.

With these steps, you should be able to format the date from the survey response to display it as DD/MM/YYYY in your Power Automate report.

Paulvan_Heerden1
New Contributor III

Thank you for your response.

Please could you be more specific in what Dynamic Values or Expressions we have to use in the Parse JSON action. It asks for Content and Schema. I am not too sure what to do there to make it work

Paulvan_Heerden1_0-1680074024259.png

After you have done this, what Inputs do you use in the Compose action? Is this where you add formatDateTime(triggerBody()?['Date'], 'dd/MM/yyyy') and replace the portions as explained in your answer?

Paulvan_Heerden1_1-1680074076809.png

Thanks for your time

Paul

 

0 Kudos
WillWoodroof
New Contributor III

Hey @Paulvan_Heerden1  or @ZaraSheikh

I'm having the same trouble with the parse JSON and compose actions to format the ESRI UTC date format to DD,MM,YYYY on the flow I created. Can someone help me with this portion, like @Paulvan_Heerden1  mentions above? 

Thanks for the help!

0 Kudos