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

How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

Hi - any help on the below would be super helpful. 

 

In SharePoint, it shows dates as DD/MM/YYYY as I changed the regional settings. I set up a flow to push out an email when things are due to expire and the email spits out the dates as YYYY/DD/MM and no matter what I do I can't change it. In SharePoint, the list is set up to show date only, not time. 

 

Is there a fix so I can show the right (for us anyway) date format? As there's a huge diff between something expiring on the 1st of Nov to the 11th of Jan. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

Hi @smather,

 

Please just try to use the function formatDateTime which could be used to return any specified format.

In my scenario, the date returned from SharePoint list is of format yyyy-MM-dd. However, I want to format it as dd/MM/yyyy.

So I used the formatDateTime function likes below:

formatDateTime(triggerBody()?['Date'],'dd/MM/yyyy')

 2.PNG3.PNG 

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

18 REPLIES 18
Highlighted
Resolver III
Resolver III

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

Hi @smather

No idea what timezone you`re using, but my example is with Eastern Europe Time.

If you want to convert a response from an approval, might try to adjust the expression:

convertTimeZone(body('Start_an_approval')?['responseDate'],'UTC','E. Europe Standard Time','dd/MM/yyyy HH:mm')

Or if you just want to convert utc:

convertTimeZone(utcNow(),'UTC','E. Europe Standard Time','dd/MM/yyyy HH:mm')

basically use  convertTimeZone(YourColumnName,'UTC','E. Europe Standard Time','dd/MM/yyyy HH:mm')

In the expression editor just move the cursor where is Your Column Name, and add the dynamic content that  you need to be converted.

Capture.JPG

 

 

 

 

https://powerusers.microsoft.com/t5/General-Flow-Discussion/Flow-reads-datetime-always-in-UTC/m-p/16...





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

Proud to be a Flownaut!





Highlighted
Community Support
Community Support

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

Hi @smather,

 

Please just try to use the function formatDateTime which could be used to return any specified format.

In my scenario, the date returned from SharePoint list is of format yyyy-MM-dd. However, I want to format it as dd/MM/yyyy.

So I used the formatDateTime function likes below:

formatDateTime(triggerBody()?['Date'],'dd/MM/yyyy')

 2.PNG3.PNG 

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Frequent Visitor

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

That's perfect, @v-yamao-msft -- thank you! & thanks @Dorul too -- not quite what I was looking for in this instance, but I'm sure that'll come in handy down the line! 

Highlighted
Advocate I
Advocate I

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

I was having a lot of issues while using DD/MM/YYYY and dd/mm/yyyy along with time stamp. The dates never came correctly. Took a while to figure out the mm and MM makes a lot of difference. For dates we need dd/MM/yyyy (M in capital). mm refers to minutes. So when I was using dd/mm/yyyy, I was getting values like 15/56/2020. The capital Ms fixed it.

Highlighted
Regular Visitor

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

Hi @v-yamao-msft .

 

I'm trying the same thing, trying to use the following to convert the current date to the UK format.

 

I'm using formatDateTime(triggerBody()?['Date'],'dd/MM/yyyy') in the 'Convert to UK date' field.

 

I'm getting this error when I'm trying it though, please help!

 

Annotation 2020-01-27 095418.png

Highlighted
Dual Super User III
Dual Super User III

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

@deanking

It looks like triggerBody()?['Date'] is null, i.e. if you are getting an item from a Sharepoint list, such column has no value assigned.

There is an easy way to assign a default date value in such cases, by means of the coalesce function, in the context of a Flow execution

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: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

Hi @efialttes , thanks for the reply.

 

So do I just put the value in the brackets of the triggerBody()? So for example, formatDateTime(triggerBody(outputs('Compose_the_Sign-up_date'))?['Date'],'dd/MM/yyyy')

 

I've tried this also but it doesn't seem to work, am I missing something in the function?

Highlighted
Dual Super User III
Dual Super User III

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

@deanking 

Not sure if triggerBody(outputs('Compose_the_Sign-up_date') is the right expression. The names given for TRigger Outputs that you can use on expressions depend on the trigger itself.

Pleas fin enclosed an animated video on how to check these names for a specific Flow whose trigger is "Sharepoint - For a selected File":

Flow-IdentifyingTriggerOutputsNames.gif

What you can do is to add a dummy "Compose" action block after the trigger, and click on the output you are interested. Once added, you simply hover the mouse over the output and will see the name that shall be used on expressions. THis is useful when you need to add it manually to an expression, since sometimes the editor is a bit buggy.

This dummy "Compose" approach is also useful if you want to easily inspect the content of a specific trigger output in a Flow Execution.

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: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

Hi @efialttes 

 

I'm not really following, here's a GIF of what I currently have.

 

Power Automate gif.gif

Highlighted
Dual Super User III
Dual Super User III

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

@deanking 

Let's try o explain my point it in a different way:

If the error says triggerBody()?['Date'] is null,

-either you are getting an item from a Sharepoint list, and its 'Date' column has no value assigned; or

-the expression triggerBody()?['Date'] does not exist

 

In order to verify if the expression triggerBody()?['Date'] exists, my suggestion is to add the dummy 'Compose' after the trigger, add the trigger output you are interested in, and inspect if it is declared as triggerBody()?['Date']

 

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: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

Hi @efialttes 

 

Just checked, the date is coming from a submission made in a form using Microsoft Forms.

 

When I hover over, this is what I'm seeing body('Get_response_details')?[rae174664fcfb4c03abb1b113fe8d549e']

 

Would this mean that I'm unable to covert it to the UK format?

Highlighted
Super User III
Super User III

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

@deanking you could always add a Convert time zone action and select the forms answer with the time in it as the Base time and then set the format string as a custom one, i.e dd/MM/yyyy. I use that action a lot.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

Highlighted
Regular Visitor

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

@RobElliott 

 

Hi Rob.

 

Not really sure how I do that, I'm new to Power Automate, only been using it a month or so.

 

So would I use as follows? In bold is the dynamic content for the date on the form.

convertTimeZone(body('Get_response_details')?['rae174664fcfb4c03abb1b113fe8d549e'])
Highlighted
Super User III
Super User III

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

You go to add an action and type in the box Convert time zone, select it and then the action will be displayed for you to enter the different fields.

convertTimeZone4.png

Rob
Los Gallardos

Highlighted
Dual Super User III
Dual Super User III

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

@deanking

So, when you tried formatDateTime(triggerBody()?['Date'],'dd/MM/yyyy') it showed an error stating the first input (I mean triggerBody()?['Date']) was null.

If I were you I would:

1.- Add a dummy compose action block, and assign it the expression body('Get_response_details')?[rae174664fcfb4c03abb1b113fe8d549e'] as its input

2.- Run again any of your flow executions, and inspect the content of the dummy compose action block. Make sure its content is the date whose format you want to change

 

Now let's assume body('Get_response_details')?[rae174664fcfb4c03abb1b113fe8d549e'] contains the date you want to reformat:

3.-Try @RobElliott suggestion, either using the expression formatDateTime(body('Get_response_details')?[rae174664fcfb4c03abb1b113fe8d549e'],'dd/MM/yyyy') or by means of the corresponding action block (more info here )

4.- If step 3. fails then I guess you need to manipulate the date format in the tricky traditional way. See this post for more info on a similar issue

 

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: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

Hi @RobElliott 

 

Awesome, that worked to convert it, so how could I use that value now?

 

I'm wanting the last bit of the flow to email a user the details, so I want to email them the date but in the UK format?

Highlighted
Regular Visitor

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

@RobElliott 

 

Ignore my last comment! Figured it haha, I've overlooked it before.

 

Thanks man!

Highlighted
Microsoft
Microsoft

Re: How to change Flow date from YYYY-DD-MM to DD-MM-YYYY

Hi @smather

 

This could be completed using the function formatDateTime. 

 

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#f...

 

Please refer the solution here:

https://powerusers.microsoft.com/t5/General-Power-Automate/How-to-change-Flow-date-from-YYYY-DD-MM-t...

 

Regards,

Erica 

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

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

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
Users online (7,584)