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

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

why does 1M differ in number of days(D) with respective to negative sign assigned to it in the prefix?

(0) ShareShare
ReportReport
Posted on by 607

Hi All,

i getting the following output :

 CalcDate(-1M, Today()) - Today() = 31D ; CalcDate(-1M, Today()): Todays date - 31 D
Today() + CalcDate(+1M, Today())  =  30D ; CalcDate(+1M, Today()): Todays date + 30 D
Why there are days are different  with 1M ?
Thanks in Advance
I have the same question (0)
  • Daniel Rimmelzwaan Profile Picture
    3,485 on at
    RE: why does 1M differ in number of days(D) with respective to negative sign assigned to it in the prefix?

    I don't think it works quite that way. When you start on March 30 and you add 4 days (4D) it goes into April so it has an effect on the month too. Same if you start on Wednesday April 29 and you add a week, it goes into May so there's an effect on the month number as well. It depends on the reference date.

    Don't try to disassemble the CalcDate command into pieces.

  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,169 Super User 2025 Season 2 on at
    RE: why does 1M differ in number of days(D) with respective to negative sign assigned to it in the prefix?

    Never actually try it, but I am assuming that is correct.

  • AXBOY Profile Picture
    607 on at
    RE: why does 1M differ in number of days(D) with respective to negative sign assigned to it in the prefix?

    Thank you so much. Also i have few small doubts :

    1. M and Q will effect the month part of the date

    2. D and W will effect the days part of the date.

    right?

  • Verified answer
    Daniel Rimmelzwaan Profile Picture
    3,485 on at
    RE: why does 1M differ in number of days(D) with respective to negative sign assigned to it in the prefix?

    No, 1M is not the same as 31D. It basically tries to simply add 1 to the month number, and if the day number is invalid it finds the first available one. So in this case it is March 31, plus one month is April 31 but that's not a valid date so it adjusts to April 30. Most of the time the day number is not adjusted, and the month number simply gets modified.

  • Verified answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,169 Super User 2025 Season 2 on at
    RE: why does 1M differ in number of days(D) with respective to negative sign assigned to it in the prefix?

    1M does not add 30 or 31 days. It's adding to the month, not to days.

    4/30/2020 + 1M will become 5/30/2020

  • AXBOY Profile Picture
    607 on at
    RE: why does 1M differ in number of days(D) with respective to negative sign assigned to it in the prefix?

    But 1M = 31D right.

    So CalcDate(+1M, Today()) , it should add 31 days with currDate .ie 5/1/2020

    But its giving me 4/30/2020, it added only 30 Days

    Why?

  • Suggested answer
    keoma Profile Picture
    32,729 on at
    RE: why does 1M differ in number of days(D) with respective to negative sign assigned to it in the prefix?

    march has 31 days, april has 30 days. ;-)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Nimsara Jayathilaka. Profile Picture

Nimsara Jayathilaka. 4,197

#2
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 3,673

#3
Sumit Singh Profile Picture

Sumit Singh 2,907

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans