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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Date Calculation

(0) ShareShare
ReportReport
Posted on by

Hi

Dynamics AX4

Can someone give a script to calculate the working days between two date fields in a report and output to a field.

Thanks

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,141 Super User 2025 Season 2 on at

    Hi Bapservice,

    You can calculate the number of days using the next coding.

    NumOfDays (integer) = Date1 - Date2;

  • Community Member Profile Picture
    on at

    If you are looking for the interval in number of days, then you could use this

    days = date2num(column1) - date2num(column2);

    Hope it helps.!

  • Community Member Profile Picture
    on at
  • Community Member Profile Picture
    on at

    Thanks Guys

    My knowledge of X++ is limited.

    At this stage i am trying to establish the working days between the  ProdTable,createdDate and the ProdTable,DlvDate and out put as a field in a report

    I presume a method script is required.

  • Suggested answer
    Community Member Profile Picture
    on at

    Have a look at this link:

    dynamicsuser.net/.../49484.aspx

  • Community Member Profile Picture
    on at

    Hi Robert

    Can you assist?

    What mods do i require to this script to use the

    ProdTable,createdDate and the ProdTable,DlvDate and out put as a field in a report

  • Community Member Profile Picture
    on at

    You could use this.

    ProdTable ProdTable;

    int days;

    ;

    days = date2num(ProdTable.createdDate) - date2num(ProdTable.DlvDate);

    Please check if this helps.!

  • Community Member Profile Picture
    on at

    When I use this method and output to  a report field (integer:LeadTime) I get the result 0

    Can someone assist please.

    display LeadTime LeadTime()

    {

    ProdTable ProdTable;

    int days;

    ;

    days = date2num(ProdTable.DlvDate) - date2num(ProdTable.createdDate);

    Return 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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans