cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Transforming a "String" field from forms to a "Date" field

Hello Hello!

 

A fresh Power Automate user here. Recently I made the flow you can see below where I capture data from a form that is filled by one person, where there is a date slot called "Activity's Date". the date in "Activity's date" is entered as a string. I would like to convert it to a date format but I am failing to do so. the main reason I am doing so is that I want to keep a track of what orders my company is receiving sorted by date.

I need a hand, please!

 

Capture00.PNG
Capture.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Transforming a "String" field from forms to a "Date" field

Hi again

As far as I know, Power Automate does not have a broad set of date format manipulation funtions as other environments (I am thinking on moment.js for example).

If so, this means you have to use expressions to adapt it to the format required by the destination, it your case Sharepoint. IN this post you will find different approaches to solve a similar problem.

 

If I were you, I would suggest to implement a test flow (manually executed) and verify which is the format more similar to the one you got that is accepted by Sharepoint connector (i .e. when we request to add a new item from PowerAutomate) as proper date.

Please note this is the standard format used by PowerAutomate:

2018-04-15T13:00:00.0000000Z

I believe there are several formats currently accepted by Sharepoint connector, but let's assume this is the only format accepted by Sharepoint connector, this means:

-you need to split 1/27/2020 in three pieces by using '/' as the separator, and build the required format by changing its order.

So if you apply the following expression...

concat(split('1/27/2020','/')[2],'-',split('1/27/2020','/')[0],'-',split('1/27/2020','/')[1],'T00:00:00.0000000Z')

...you will get:

2020-1-27T00:00:00.0000000Z

 

-if Sharepoint accepts this format (2020-1-27T00:00:00.0000000Z) then you got it! If not, probably you will need to declare the months and days with two digits, also by using expressions. So, you can evaluate the length of

split('1/27/2020','/')[0]

If length is 1 you should concat a 0 at the beginning of the month.

Hope this helps

 

 

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

6 REPLIES 6
Highlighted
Dual Super User III
Dual Super User III

Re: Transforming a "String" field from forms to a "Date" field

@mabdouf 

What's the format you are currently receiving?

Or... you will find more info about date format manipulation here

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Regular Visitor

Re: Transforming a "String" field from forms to a "Date" field

The field i am receiving is a string format

Highlighted
Dual Super User III
Dual Super User III

Re: Transforming a "String" field from forms to a "Date" field

Sorry I did not explain myself properly. Can you share an example of the date format you are trying to manipulate?

2020-01-27

2020/27/01

Monday January 27th

...



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Regular Visitor

Re: Transforming a "String" field from forms to a "Date" field

The date's format is 

1/27/2020

 

Keep in mind I took a look at the post you mentioned in the previous reply, but i am not quite sure its relevant to my case. 

The field I want to change to a date format is the "Date of Activity".


 capture000.png

Highlighted
Dual Super User III
Dual Super User III

Re: Transforming a "String" field from forms to a "Date" field

Hi again

As far as I know, Power Automate does not have a broad set of date format manipulation funtions as other environments (I am thinking on moment.js for example).

If so, this means you have to use expressions to adapt it to the format required by the destination, it your case Sharepoint. IN this post you will find different approaches to solve a similar problem.

 

If I were you, I would suggest to implement a test flow (manually executed) and verify which is the format more similar to the one you got that is accepted by Sharepoint connector (i .e. when we request to add a new item from PowerAutomate) as proper date.

Please note this is the standard format used by PowerAutomate:

2018-04-15T13:00:00.0000000Z

I believe there are several formats currently accepted by Sharepoint connector, but let's assume this is the only format accepted by Sharepoint connector, this means:

-you need to split 1/27/2020 in three pieces by using '/' as the separator, and build the required format by changing its order.

So if you apply the following expression...

concat(split('1/27/2020','/')[2],'-',split('1/27/2020','/')[0],'-',split('1/27/2020','/')[1],'T00:00:00.0000000Z')

...you will get:

2020-1-27T00:00:00.0000000Z

 

-if Sharepoint accepts this format (2020-1-27T00:00:00.0000000Z) then you got it! If not, probably you will need to declare the months and days with two digits, also by using expressions. So, you can evaluate the length of

split('1/27/2020','/')[0]

If length is 1 you should concat a 0 at the beginning of the month.

Hope this helps

 

 

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

Highlighted
Dual Super User III
Dual Super User III

Re: Transforming a "String" field from forms to a "Date" field

One more comment:

I've just posted the following idea, I think if implemented could save a lot of time struggling with date format and expressions

https://powerusers.microsoft.com/t5/Power-Automate-Ideas/Simplified-date-formatting/idi-p/454197#M19... 

Feel free to vote it

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

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!

Users online (6,856)