Microsoft Flow – Next Month is okay, but don’t go any further!

Update: 28 February 2020, This problem has now been resolved and the Add to time now calculates the next month better.

 

Today I came across problem with calculating dates in Microsoft Flow.

Today’s date is 30 April 2018. I did a calculation using the Date connector in Microsoft Flow and found that add 1 month gives me 31 May 2018. This is potentially better than expected as I found the last  day of the month.

But now I’m trying to add 3 months

Now I’m getting 29 July 2018. We seem to have lost a few days there!

Then I thought maybe adding 3 times 1 month will give me the result.

addToTime expression

After the above tests I tried using the addToTime function instead:

addToTime(variables(‘Date’),1,’Month’)
But these give the same result

I’m not sure what to suggest at the moment other than upvoting the following bug

https://powerusers.microsoft.com/t5/I-Found-A-Bug/Add-months-doesn-t-work/m-p/111352#M2134

Share
Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

View Comments

  • This has been driving me crazy as well, and I believe it should continue to be a bug as the desired normal functionality is not working as expected.

    That being said, I do believe I have found the reason behind the inconsistency and possible methods to fix this. This method is expected to take the input of interval and add that number of months to the current date, however through initial testing, the actual functionality takes the interval input and adds the number of days in the month corresponding to that number and adds it to the date. So if the interval is 1 it adds 31 because 1=January, 2 would be 28 because 2=February, 3 would be 31 because 3=March and so on and so on.

    Here is the output data from tests run with the starting date of 05/10/2018:

    Interval Date Output Difference in Days
    0 05/10/2018 0
    1 06/10/2018 31
    2 07/08/2018 28
    3 08/08/2018 31
    4 09/07/2018 30
    5 10/08/2018 31
    6 11/07/2018 30
    7 12/08/2018 31
    8 01/08/2019 31
    9 02/07/2019 30
    10 03/10/2019 31
    11 04/09/2019 30
    12 05/10/2019 31

Recent Posts

Calculate the Sum for a SharePoint column in Power Automate

Last week Shane Young asked me about calculating the Sum for a SharePoint column in…

3 hours ago

Object must implement IConvertible in Power Apps

In Power Apps when you do a Patch to create a new item or to…

4 days ago

Get started with adaptive cards in Power Automate

Getting started with adaptive cards can be difficult. In this post i have written some…

1 week ago

Create PDF documents from data in Power Automate

In this post I will look at how to create PDF documents from data. Use…

2 weeks ago

Unnest nested arrays in Power Automate

We all know this problem, you have a nested array in Power Automate but how…

3 weeks ago

Advanced settings not loading in Power Platform

Yesterday one of my clients showed me an issues where the Advanced settings didn't load.…

4 weeks ago
%%footer%%