Skip to main content
All CollectionsFAQsBuilding πŸ‘·β€β™‚οΈ
How to format dates for Power Automate
How to format dates for Power Automate

Lets explore how we can format dates in Team Forms to avoid complex Power-Fx formulas

Updated over a week ago

The Date/Time component is a valuable tool for capturing date inputs via a user-friendly calendar picker. As part of its design, this component stores all date and time inputs in the ISO8601 format, ensuring the inclusion of time zone information. It's crucial to understand that the component's format setting is primarily for controlling how the date appears to the user. However, the underlying data is consistently stored in ISO8601 format, allowing for easy re-rendering of the date to accommodate various time zones or formats based on the user's locale settings.

With that said it can be useful to pass the date to PowerAutomate is a different format due to the complexity of working with dates and times in Power-Fx. Team Forms offers various options to do so, however in this article we will focus on how to use a calculated value to achieve this.

  1. Drag and drop the date/time component into your form and configure it as desired

  2. Drag a text field into your form

  3. Within the display tab select hidden to hide the component in the form and pdf

  4. Next in the data tab, scroll down to calculated value. Here we will write a javascript expression to output the data in the desired format. Team Forms provides the moment.js library to assist with this.

    value = moment(data.dateTime).format('YYYY-MM-DD')

  5. Now within your Power Automate flow you can access the formatted date using the calculated text field we set up earlier

Did this answer your question?