Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to get days from Date Formula datatype?

(0) ShareShare
ReportReport
Posted on by 607

Hi All,

I want to get the number of days from dateformula datatype, like 1M = 31D, 1Y = 365D, 1W = 7D  How can i achieve this ?

Also whats the difference between 28D and D28?

The result of : 

  1. CalcDate('-28D',Today()) = 2/29/2020. 
  2. ClacDate('-D28',Today()) = 2/28/2020 , how?   Please explain in detail?
  • AXBOY Profile Picture
    607 on at
    RE: How to get days from Date Formula datatype?

    Oh okay, got it. it calcs the nearest 28th day in the past. Thank you

  • Verified answer
    keoma Profile Picture
    32,727 on at
    RE: How to get days from Date Formula datatype?

    if the current date of your windows system is 3/28/2020 or e.g. 3/27/2020, then the result of CalcDate('-D28',Today()) is 2/28/2020. if the current windows date is later, e.g. 3/29/2020, then the result is 3/28/2020.

  • AXBOY Profile Picture
    607 on at
    RE: How to get days from Date Formula datatype?

    @FranzKalchmair

    Hi,

    You said, CalcDate('-D28',Today()) ; Output : 2/28/2020,

    But its giving : 3/28/2020, its returning the 28th of the current month not the previous month.

    Only for For X = 30 and 31, CalcDate('-DX',Today());  i am getting Output = 2/29/2020

    and for X =1-29,CalcDate('-DX',Today()); Output = 3/X/2020 ; It calcs the Xth day of the current month.

    Please Help!

  • Suggested answer
    keoma Profile Picture
    32,727 on at
    RE: How to get days from Date Formula datatype?

    i modified my answer from yesterday, 3/28/2020, and described in detail the results. should be helpful.

    so, my results from yesterday are correct and yours from today also.

  • Suggested answer
    THE Italian Profile Picture
    on at
  • AXBOY Profile Picture
    607 on at
    RE: How to get days from Date Formula datatype?

    I use US notation then.

  • keoma Profile Picture
    32,727 on at
    RE: How to get days from Date Formula datatype?

    29/3/2020 is GB (english and global) notation

    3/29/2020 is US notation

  • AXBOY Profile Picture
    607 on at
    RE: How to get days from Date Formula datatype?

    How  to check that date notation?

  • Suggested answer
    keoma Profile Picture
    32,727 on at
    RE: How to get days from Date Formula datatype?

    do you use the US or the GB date notation?

  • AXBOY Profile Picture
    607 on at
    RE: How to get days from Date Formula datatype?

    I tried the following cases and the following results which doesnt quite really match what you said:

    Queries :

    Today() = 3/29/2020

    For X = 1 to 29, CalcDate('-DX',Today()); Output = 3/X/2020 ; It calcs the Xth day of the current month.

    For X = 30 & 31, CalcDate('-DX',Today()); Output = 2/29/2020

    For X = 1 to 30 ,  CalcDate('+DX',Today()); Output = 4/X/2020 ; It calcs the Xth day of the next month,which is correct like you said.

    But for X=  31, CalcDate('+DX',Today()); Output = 3/X/2020 ; It calcs the Xth day of the Current month

    PLEASE HELP!

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

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

#1
YUN ZHU Profile Picture

YUN ZHU 501 Super User 2025 Season 1

#2
Sagar Dangar, MCP Profile Picture

Sagar Dangar, MCP 384

#3
Mansi Soni Profile Picture

Mansi Soni 366

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans