cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sacheu
Level: Powered On

How can i get the month in string on a date 20 days ago from now

Hi, 

I am trying to get  the month in string on a date 20 days ago from now

Here is the expression I tried in my flow:

 

addDays( formatDateTime(utcNow(), 'dd-mm-yyyy'), -20)
 
But I get an error saying 
 
In function 'addDays', the value provided for date time string '15-28-2020' was not valid. The datetime string must match ISO 8601 format.'.
 
Can you please tell me if there is another way to do this?
2 REPLIES 2
Highlighted
Super User
Super User

Re: How can i get the month in string on a date 20 days ago from now

Hi @sacheu in Power Automate months are always in upper case MM. Lower case is for minutes. One way to get just the month is to use a Convert time zone action:
MM.png

The output of MM will be 12, MMM will give you Dec and MMMM December and you can use the Converted Time output in follow-on actions.

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.

 

Community Support Team
Community Support Team

Re: How can i get the month in string on a date 20 days ago from now

Hi @sacheu ,

 

You could take a try with expression below to achieve the requirement:

formatDateTime(addDays(utcNow(),-20),'MM')

Please let me know if your problem could be solved.

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
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

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

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!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Users online (5,145)