Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at firstname.lastname@example.org
Microsoft Power Automate have indeed have lot of power in its Kitty. It has all the functions required to perform the minute operations that are required to perform our day to day task.
And one of our day to day requirement is to convert a string to datetime. However things can sometimes be complex for the easiest of stuffs.
And one such requirement is the converting a string to Date format in Power Automate.
Let’s try with an example. Let’s say we have a date input string in the below format – 26,02,2020
As you can see the date we are receiving as day, month and year separated by comma. And say you need to show the same date as 26 Feb 2020. I have deliberately taken a format which datetime functions in PowerAutomate can’t recognize.
So let’s see how we can do it.
For the demo I have taken a sample flow where I initialize a string parameter with the input that I am receiving
Since this format is not understood by Power Automate datetime functions, if we pass this directly to those functions it would lead to an error. So in the next step I split it to get my day, month and year out of it.
So now have an array with my day, month and year values.
And now the final step. To convert this into the desired output format. For this I use the formatDateTime function in PowerAutomate.
That’s it. Now when I run the flow, below is the output.
Awesome isn’t it? A simple tip and yet so handy and so frequently required.
Hope this helps!