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

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?
I have the same question (0)
  • 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,729 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,729 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,729 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,729 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

Responsible AI policies

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

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,678 Super User 2025 Season 2

#2
Sumit Singh Profile Picture

Sumit Singh 2,635

#3
Jeffrey Bulanadi Profile Picture

Jeffrey Bulanadi 2,210

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans