0

I have built a flow which collects data from a Form to Excel file, saves the each new form record as a new row in the file in SharePoint and summarizes the form data into an e-mail.

The form collects the dates from the form in MM/dd/yyyy format, and it populates the records into Excel in that format. However, when I use the date fields to populate the e-mail, the e-mails send in yyyy/MM/dd format. How can I get the e-mails into the format I want?

I can't figure out why the Form, and the Excel file are correct, but "Office 365 Outlook" seems to change the date format?

2 Answers 2

0

Date time formatting is a constant problem I come across also!

Have you tried formatDateTime() expression to just "remind" it?

For example, if your dynamic content field for date is 'Timestamp' from your original trigger:

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

Type formatDateTime( into Expression, then click over to Dynamic content tab and click the date field from your form, then type in ,'MM/dd/yyyy' and press OK. Hope that works for you!

formatDateTime snippet

enter image description here

13
  • Yes, I have tried that with my fields ['Start Date'] and ['End Date'] Dynamic fields, and it kept returning to me with the entire text of the formula into the emails. I tried adding this just above the Email action, and I tried it before those actions after the trigger and get responses action. It didn't work for me, so I need specific instruction on what action to use and where to make this work.
    – LabMom
    Commented Jul 2, 2020 at 12:49
  • You can put it directly in wherever you are already putting in the date. You don't need a totally separate action. You just need to make sure the formula is inputted as an expression. You can also make the formula up in a Compose action, but it's ultimately the same. You still have to put the formula in Expression.
    – ichinap
    Commented Jul 6, 2020 at 2:43
  • The formula should come up as a pink box if you've done it correctly.
    – ichinap
    Commented Jul 6, 2020 at 2:44
  • I typed it in exactly like this: formatDateTime(triggerBody()?['Timestamp'],'MM/dd/yyyy') with my field names instead of "Timestamp". Do you use the single quotation mark to surround the field name and the date format? ['Timestamp'] and 'MM/dd/yyyy' or are those just placeholders in the examples and you don't actually write it in the formula?
    – LabMom
    Commented Jul 6, 2020 at 13:30
  • Status Test failed Error Flow Run Failure: One or more fields provided is of type 'Null'. I tried it with 'Start Date' the name of my field and 'StartDate' with no space and I get the same Null error.
    – LabMom
    Commented Jul 6, 2020 at 13:43
0

Please use the formatDateTime() expression to format the date to MM/dd/yyyy.

Similar issue:

https://powerusers.microsoft.com/t5/General-Power-Automate/How-to-format-date-value-in-email-body-to-display-as-MM-dd-yyyy/m-p/193671

More information:

https://docs.microsoft.com/en-us/system-center/orchestrator/standard-activities/format-date-time?view=sc-orch-2019

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#formatdatetime

3
  • I don't understand how to apply this example to my flow. I have a "Start Date" and "End Date" that I want to convert. These appear both in the Subject Line and the Body of the email. In the Apply to Each section, I don't have "value" or "modified" to choose from under "dynamic" content.
    – LabMom
    Commented Jul 1, 2020 at 12:44
  • If possible, please provide detailed steps in your flow so that I can test and update the results for you.
    – Julie_MSFT
    Commented Jul 2, 2020 at 5:38
  • Thank you @Julie_MSFT I'm not sure how to add a screenshot. Form-When a new response is submitted Get Response Detail - "list of responses" Branch to Email me with the details (Outlook) and Add a row in an Excel sheet. The form generates and updates to the Excel sheet in MM/dd/yyyy But the date fields in the Email convert to yyyy/MM/dd Subject: Vacation - "Your Name", "Start Date" to "End Date" Body: "Your Name has requested vacation Dates" "Start Date" to "End Date"
    – LabMom
    Commented Jul 2, 2020 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.