web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Add number of month to...
Power Automate
Answered

Add number of month to a date

(0) ShareShare
ReportReport
Posted on by 13

I have problem with Add to time when adding  for example 6 month. Add to time adds always 30 days resulting in the wrong date in the future. se below

 

using below on 15-04-2019 witll result in 13-10-2019 and not 15-10-20191.png

 

Categories:
I have the same question (0)
  • ScottShearer Profile Picture
    25,278 Most Valuable Professional on at

    @Assad 

    It appears as though the issue is with the NextDate and not with the Add to Time action.  Can you post a screen shot from a run that shows the Add to time action.  That will allow you to see the NextDate input.

    AddToTime.jpg

  • Assad Profile Picture
    13 on at

    Hi @Scott

     

    You have the same issue in your example. you startdate is 22 and the end date is 20

    Her is another exampel from my flow running adding just one month ending with wrong date 13-04 ends as 14-05

    because it adds 31 days when april to may is only 30 days

    2.png

     

  • v-yamao-msft Profile Picture
    on at

    Hi @Assad ,

     

    Thanks for feedback.

     

    The issue could be reproduced by me.

     

    I will help report it and back to you later.

     

    Best regards,

    Mabel

     

  • Assad Profile Picture
    13 on at

    Thanks. if not a bug fix maybe a workarround will be nice. I have customer waiting to go online 

  • Assad Profile Picture
    13 on at

    I created a very ugly logik that do the job. the next step is to beatify the logik. any other ideas is welcome

    1- I need the to find if february is 28 or 29 days 

    image.png

    if(or(equals(mod(int(formatdatetime(variables('Date'),'yyyy')),400),0),
    and(equals(mod(float(int(formatdatetime(variables('Date'),'yyyy'))),4),0),
    not(equals(mod(int(formatdatetime(variables('Date'),'yyyy')),100),0)))),29,28)
     
    2- Adding 3 month as an example
    The idea her is to do until 3 times
    find the correct number of days and updating "Date" until i have my
    final result "Date"
    image.png
    if(equals(formatdatetime(variables('Date'),'MM'),'01'),'31',
    if(equals(formatdatetime(variables('Date'),'MM'),'02'),variables('Leap'),
    if(equals(formatdatetime(variables('Date'),'MM'),'03'),'31',
    if(equals(formatdatetime(variables('Date'),'MM'),'04'),'30',
    if(equals(formatdatetime(variables('Date'),'MM'),'05'),'31',
    if(equals(formatdatetime(variables('Date'),'MM'),'06'),'30',
    if(equals(formatdatetime(variables('Date'),'MM'),'07'),'31',
    if(equals(formatdatetime(variables('Date'),'MM'),'08'),'31',
    if(equals(formatdatetime(variables('Date'),'MM'),'09'),'30',
    if(equals(formatdatetime(variables('Date'),'MM'),'10'),'31',
    if(equals(formatdatetime(variables('Date'),'MM'),'11'),'30',
    if(equals(formatdatetime(variables('Date'),'MM'),'12'),'31','31'))))))))))))

     

  • v-yamao-msft Profile Picture
    on at

    Hi @Assad ,

     

    The issue has been reported.

     

    PGs are working on a fix on this issue.

     

    However, I am afraid that there is no easy workaround for this.

     

    Best regards,

    Mabel

     

  • Verified answer
    Assad Profile Picture
    13 on at

    Hi @v-yamao-msft 

    I tried to do a work arround my self. I am not sure if it could be done in another way but her is the work arround

     

    Step 1 - Insure Leap year for february is it 28 or 29 - it is tested and works fine

    image.png

    if(or(equals(mod(
    int(formatdatetime(variables('Date'),'yyyy')),400),0),
    and(equals(mod(float(int(formatdatetime(variables('Date'),'yyyy'))),4),0),
    not(equals(mod(int(formatdatetime(variables('Date'),'yyyy')),100),0)))),29,28)
     
    Step 2 - adding 3 month as an example
    I used a do until count 3 times. That adds the correct number of days from the month 
    reached in the continiously updated variable "Date".

    image.png

    if(equals(formatdatetime(variables('Date'),'MM'),'01'),'31',
    if(equals(formatdatetime(variables('Date'),'MM'),'02'),variables('Leap'),
    if(equals(formatdatetime(variables('Date'),'MM'),'03'),'31',
    if(equals(formatdatetime(variables('Date'),'MM'),'04'),'30',
    if(equals(formatdatetime(variables('Date'),'MM'),'05'),'31',
    if(equals(formatdatetime(variables('Date'),'MM'),'06'),'30',
    if(equals(formatdatetime(variables('Date'),'MM'),'07'),'31',
    if(equals(formatdatetime(variables('Date'),'MM'),'08'),'31',
    if(equals(formatdatetime(variables('Date'),'MM'),'09'),'30',
    if(equals(formatdatetime(variables('Date'),'MM'),'10'),'31',
    if(equals(formatdatetime(variables('Date'),'MM'),'11'),'30',
    if(equals(formatdatetime(variables('Date'),'MM'),'12'),'31','31'))))))))))))
  • v-yamao-msft Profile Picture
    on at

    Hi @Assad ,

     

    Thanks for sharing.

     

    It would be helpful for other customers who have the same issue. I really appreciate the workaround you’ve provided.

     

    Hope the issue could be fixed soon.

     

    Best regards,

    Mabel

     

  • robertoz Profile Picture
    7 on at

    Hi All,

    it seems to be fixed already:

    robertoz_0-1604488551567.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 315 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 273 Super User 2026 Season 1

#3
Power Platform 1919 Profile Picture

Power Platform 1919 117 Super User 2026 Season 1

Last 30 days Overall leaderboard