cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ezFlow
Helper II
Helper II

Covert String into date

I'm pulling a string: 19761120, which I need to add to a SharePoint date field.

How do I convert or split the string to a format like 1976/11/20  that a Date field can accept?

5 REPLIES 5
abm
Super User
Super User

Hi @ezFlow 

 

You need to use the substring function. Here it is

 

 

image.png

 

Above expressions are as follows:

 

substring(string(outputs('Compose')),0,4)
substring(string(outputs('Compose')),4,2)
substring(string(outputs('Compose')),6,2)
 
Here is my test result
 
image.png


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials
ezFlow
Helper II
Helper II

Saved the string as a DOBVAR, and made it work.

concat(substring(variables('DOBVAR'),1,4), '/', substring(variables('DOBVAR'), 5, 2), '/', substring(variables('DOBVAR'), 7, 2))

Hi @ezFlow 

 

You sure substring(variables('DOBVAR'),1,4) is working? The index starts with zero.

 

See my results below.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

On all the Date field the substring starts with 0.
This field (all comes from an excel that is generated by 3rd party software), worked with 1. 
Perhaps there is a space

Hi @ezFlow 

 

Yes thats the only reason that worked. I would say use the trim() to make sure the space is removed and start the index at 0. Thats the way I would do it. 

 

If you happy with my earlier response please mark it as solution accepted.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

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

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (5,198)