cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TD-19976
Regular Visitor

Convert text from Compose into Date for SharePoint

I'm building a flow to pull email body content and create entries into a SharePoint list.

 

I have several 'Compose' actions that are working correctly to break the email body down into individual field items for the SharePoint list, but I'm struggling to convert the dates from the Compose outputs ("dd.mm.yyyy") into the required MM/dd/yyyy format for writing to SharePoint - can anyone please help?

 

Screenshot 2021-03-17 084123.png

1 ACCEPTED SOLUTION

Accepted Solutions
JoAnneCharlotte
Helper II
Helper II

I've managed to do this by using 3 x compose and substring to extract the day, month and year:

 

I'm UK so I apologise I went in auto pilot and did this in dd/MM/yyyy but you can switch it around:

Original date put into a compose - dd.mm.yyyy

 

substring(outputs('OriginalDate'),0,2) - gets my day
substring(outputs('OriginalDate'),3,2) - gets my month
substring(outputs('OriginalDate'),6,4) - gets my year
concat(outputs('Year'),'-',outputs('Month'),'-',outputs('Day')) - joins them and puts them in UTC format
formatDateTime(outputs('Join'),'dd/MM/yyyy') - formats as dd/MM/yyyy (you can switch it to MM/dd/yyyy)
 
Screenshot 2021-03-17 094520.png
Hope this helps!

View solution in original post

7 REPLIES 7
DamoBird365
Microsoft
Microsoft

Hi @TD-19976 

 

Take a look at my earlier solution here

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Cheers,
Damien


JoAnneCharlotte
Helper II
Helper II

I've managed to do this by using 3 x compose and substring to extract the day, month and year:

 

I'm UK so I apologise I went in auto pilot and did this in dd/MM/yyyy but you can switch it around:

Original date put into a compose - dd.mm.yyyy

 

substring(outputs('OriginalDate'),0,2) - gets my day
substring(outputs('OriginalDate'),3,2) - gets my month
substring(outputs('OriginalDate'),6,4) - gets my year
concat(outputs('Year'),'-',outputs('Month'),'-',outputs('Day')) - joins them and puts them in UTC format
formatDateTime(outputs('Join'),'dd/MM/yyyy') - formats as dd/MM/yyyy (you can switch it to MM/dd/yyyy)
 
Screenshot 2021-03-17 094520.png
Hope this helps!

Thanks @JoAnneCharlotte but I get a reference error on the first stage, when trying to get the Day;

 

Screenshot 2021-03-17 135953.png

Check you have the correct output in the substring. You may want to rename one of them as they are very similar and you could be accidentally adding the wrong one in the expression.

Thanks @JoAnneCharlotte - my revision of your substring looks like this;

substring(outputs('Date of Event'),0,2)

And remember your start point is 0, not 1

 

substring(outputs(‘Date_of_Event’),0,2)

 

I try to avoid spaces when giving names - as flow will replace a space with an _

Awesome!  Fixed, working & correct!  Thanks @JoAnneCharlotte , marked as Solution 😄

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (4,036)