Skip to main content

Notifications

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

  • Community Member Profile Picture
    on at
    RE: Date Calculation

    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;

    }

  • Community Member Profile Picture
    on at
    RE: Date Calculation

    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
    RE: Date Calculation

    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

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Date Calculation

    Have a look at this link:

    dynamicsuser.net/.../49484.aspx

  • Community Member Profile Picture
    on at
    RE: Date Calculation

    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.

  • Community Member Profile Picture
    on at
  • Community Member Profile Picture
    on at
    RE: Date Calculation

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

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

    Hope it helps.!

  • André Arnaud de Calavon Profile Picture
    294,882 Super User 2025 Season 1 on at
    RE: Date Calculation

    Hi Bapservice,

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

    NumOfDays (integer) = Date1 - Date2;

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
Zain Mehmood Profile Picture

Zain Mehmood 6 Moderator

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans