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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

how to get The difference between two date in ax 2012 in detail years months days ???

(0) ShareShare
ReportReport
Posted on by 5,125

i need to get the difference between two date using x++ as 

date 1 = 07/07/2007

date 2 =01/06/2014

so the difference will be 

6 Years 

10 Months 

26 Day 

as in the below window calculator 

 any help or suggestion will be appreciated 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Florian Hopfner Profile Picture
    2,466 on at
    Try the intvNo function.
  • mostafa mahmoud Profile Picture
    5,125 on at

    but it dose not give the direct result

  • Verified answer
    Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    There is nothing out of the box (AFAIK), partly because there is no single answer. You can calculate the difference is several different ways.

    You'll find many discussions about this topic (e.g. http://stackoverflow.com/questions/1525990/difference-in-months); just use your favorite search engine. You may also find that somebody else's solutions suits you and use it. Otherwise just calculate it by yourself.

  • PA-22040759-0 Profile Picture
    6,194 on at

    As Martin points out, this is not a trivial calculation.

    Leap years, uneven lengths of months and different calendar rules for different locales makes it hard to come up with a single correct result of such a calculation.

    Maybe you can use something like the following libary to help you out: www.codeproject.com/.../Time-Period-Library-for-NET

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans