Hi again!
@Rebecca7 wrote:
Hello my friend!
That expression worked! (first(split('6/3/20 11:45:17','/')))
But I was thinking better... is it possible to turn this date into "June 2020"?
If you need complex transformations, you will probably need to transform your source date format into ISO 8601 format, that is the one internally supported by Power Automate.
yyyy-MM-ddTHH:mm:ss.fffffffZ
In order to get the year as 'yyyy' you can add an 'Initialize variable' action block, type string, lets call it inputYear, and assign as its value the following expression:
concat('20',first(split(last(split('6/3/20 11:45:17','/')),' ')))
In order to get the month as 'MM' you can add an 'Initialize variable' action block, type string, lets call it inputMonth, and assign as its value the following expression :
if(equals(length(first(split('6/3/20 11:45:17','/'))),2),first(split('6/3/20 11:45:17','/')),concat('0',first(split('6/3/20 11:45:17','/'))))
In order to get the day as 'dd' you can add an 'Initialize variable' action block, type string, lets call it inputDay, and assign as its value the following expression:
if(equals(length(split('6/3/20 11:45:17','/')[1]),2),split('6/3/20 11:45:17','/')[1],concat('0',split('6/3/20 11:45:17','/')[1]))
In order to get everything into ISO 8601 you can use the following expression
concat(variables('inputYear'),'-',variables('inputMonth'),'-',variables('inputDay'),'T00:00:00.000000Z')
Now you can use formatDateTime() to transform it into June 2020.
formatDateTime(concat(variables('inputYear'),'-',variables('inputMonth'),'-',variables('inputDay'),'T00:00:00:000000K'),'MMMM yyyy')
Hope this helps