cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Impactful Individual
Impactful Individual

Convert string from PowerApps to datetime in specific format

Hi all

 

I am struggling with this ...

I receive a string in different formats from a PowerApp that is coming from a DatePicker.

Altough I have set in the Function FlowName.Run(...) that all dates should be in the DateTime.ShortDate format (from PowerApps) it arrives in different formats in my Flow.

 

The formats i receive are:

  • April 17, 2019
  • 17-4-2019
  • 4-17-2019

This doesn't make sense for me as I pass this value in a Function =>

Text(DateTimeControlName.SelectedDate,DateTimeFormat.ShortDate)

But still I receive different formats in Flow (shown above).

 

I am trying to convert them all regardless of how they come in, into the MM-dd-yyyy format but i fail each time.

I tried the formatDateTime() function and the Convert to timezon action in Flow but each time i get

Unable to process template language expressions for action X at line '1' and column '2554': 'In function 'converttimezone', the value provided for date time string '18-4-2019' was not valid. The datetime string must match ISO 8601 format.'.

What am I overseeing here?

 

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Impactful Individual
Impactful Individual

Re: Convert string from PowerApps to datetime in specific format

@zahir-firasta  thank you, i tried this one before but this does not work either, gives me the same error.

See attachment: screenshot Flow.jpg

 

formatDateTime(variables('DatumGesprek'),'MM-dd-yyyy')

I can't seem to validate it having it between the @{} like this

@{formatDateTime(variables('DatumGesprek'),'MM-dd-yyyy')}

So i paste it in the 'Input' field which does validate but still gives me the error.

 

View solution in original post

Highlighted
Impactful Individual
Impactful Individual

Re: Convert string from PowerApps to datetime in specific format

Hi all,

 

First of all I made a mistake and have clicked "accept as solution" while I didn't wanted to do that ...

 

I have solved my problem by formatting my datetime which comes from PowerApp to an ISO format (yyyy-mm-dd) so that all dates come in the same format in my Flow and the Flow formatDateTime() function only accepts ISO xxx formats (noticed this in my errors) so this worked as expected.

 

Thank you for your time and suggestions!

View solution in original post

3 REPLIES 3
Highlighted
New Member

Re: Convert string from PowerApps to datetime in specific format

@dimi Can you please try using a Compose action as explained here with "MM-dd-yyyy" format?

Highlighted
Impactful Individual
Impactful Individual

Re: Convert string from PowerApps to datetime in specific format

@zahir-firasta  thank you, i tried this one before but this does not work either, gives me the same error.

See attachment: screenshot Flow.jpg

 

formatDateTime(variables('DatumGesprek'),'MM-dd-yyyy')

I can't seem to validate it having it between the @{} like this

@{formatDateTime(variables('DatumGesprek'),'MM-dd-yyyy')}

So i paste it in the 'Input' field which does validate but still gives me the error.

 

View solution in original post

Highlighted
Impactful Individual
Impactful Individual

Re: Convert string from PowerApps to datetime in specific format

Hi all,

 

First of all I made a mistake and have clicked "accept as solution" while I didn't wanted to do that ...

 

I have solved my problem by formatting my datetime which comes from PowerApp to an ISO format (yyyy-mm-dd) so that all dates come in the same format in my Flow and the Flow formatDateTime() function only accepts ISO xxx formats (noticed this in my errors) so this worked as expected.

 

Thank you for your time and suggestions!

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (7,338)