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 3 months 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. 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 in a different format due to the complexity of working with dates and times with Power Automate expressions. 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 hidden component into your form (Note that the hidden component is a special component available under the data components)

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

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

  4. 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?