cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sudosaurus
Post Prodigy
Post Prodigy

Custom ID field with date formatted as YYYY-MM-DD needs to be formatted as DD-MM-YYYY

Hello,


I have a custom field named "Contract Ref" which is made up of the following format:

[TEXT]-[COLUMN]-[COLUMN]

Where the first Column is "Contract Start Date" and the second column is "ID".

 

The "Contract Start Date" is formatted correctly in SharePoint as 09/06/2020 however when my flow runs, it is formatting the "Contract Start Date" as 2020-09-06. This needs to be formatted as 09-06-2020 so that the Contract Ref column reads as LWCM-09-09-2020-5

 

list.png

 

Register.png

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @sudosaurus 

 

A small correction in @ManishJain  suggestion. The format you need to use is dd-MM-yyyy. It's case sensitive.

 

Remove the Contract Start Date mapping then place cursor between the hyphen's.  Click the Expression tab on your right (next to Dynamic content). Start typing formatDateTime(,'dd-MM-yyyy'). Then place the cursor before the comma then click the dynamic content and map the value. 

 

image.png

 

Finally you will have the exprssion as formatDateTime(''yoursharepointschemnamecontactstart','dd'MM-yyyy'). Click Ok. This should place the format expression under the Contract Ref between LWCM- and -ID

 

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

View solution in original post

7 REPLIES 7
ManishJain
Solution Sage
Solution Sage

Hi @sudosaurus ,

 

If the Contract start date is of type date then you can use formatDatetime and format it.

eg. formatDateTime(ContractDate,'DD-MMM-YYYY')

 

Thanks

In which part of my flow do I insert that?

When you are adding the field Contract Ref LWCM -  . After LWCM - use expression in place of actual field.

 

Thanks

When I try this, it says "The Expression is Invalid".

 

formatDateTime(Contract Start Date,'DD-MMM-YYYY')

Hi @sudosaurus ,

 

Please ensure that cursor is at the right location. When you click ok and if you get that it could be that it is not finding where to insert the expression.

 

Thanks

Hi @sudosaurus 

 

A small correction in @ManishJain  suggestion. The format you need to use is dd-MM-yyyy. It's case sensitive.

 

Remove the Contract Start Date mapping then place cursor between the hyphen's.  Click the Expression tab on your right (next to Dynamic content). Start typing formatDateTime(,'dd-MM-yyyy'). Then place the cursor before the comma then click the dynamic content and map the value. 

 

image.png

 

Finally you will have the exprssion as formatDateTime(''yoursharepointschemnamecontactstart','dd'MM-yyyy'). Click Ok. This should place the format expression under the Contract Ref between LWCM- and -ID

 

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

Thank you for your help! 🙂

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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (3,401)