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

Announcements

News and Announcements icon
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
    306,371 Super User 2026 Season 1 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans