Date Difference in months.
zulq
Member Posts: 204
Want to find the difference between two dates and return the corresponding number of months.
For example Let say: Begin Date and End Date and they both have values 01/01/05 and 31/12/05 respectively. Now I want to find the difference but in months only. With the above example the number of months will be 12.
Any ideas please!
For example Let say: Begin Date and End Date and they both have values 01/01/05 and 31/12/05 respectively. Now I want to find the difference but in months only. With the above example the number of months will be 12.
Any ideas please!
Few years ago we were not existing and few years to come we would be in the grave! So what will benefit us in the grave?
0
Comments
-
and difference between:
31/01/06 and 01/02/06 will be 1 month or 0?
between 01/01/06 and 28/02/06 will be 1 or 2?
Please, more details needed. But best thing will be to use DATE2DMY function to take numbers of month and year for each date and calculate the values from this...0 -
You could use a variable Calendar > Record > Date
IF (FromDate <> 0D) and (ToDate > FromDate) THEN BEGIN Calendar.RESET; Calendar.SETRANGE("Period Type",Calendar."Period Type"::Month); Calendar.SETRANGE("Period Start",FromDate,ToDate); Months := Calendar.COUNT; END ELSE Months := 0;
The problem with this type of code is 01 Jan 07 to 01 Feb 07 will return 2 Months.
When it is only 1 month 1 day!
31/01/06 and 01/02/06 will be 1 month
between 01/01/06 and 28/02/06 will be 2 MonthsAnalyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
Hello Kine,
Here the dates are going to be standard...Payments are made monthly...thus the dates will be begin of month to end of month respectively.
Ok will try these and get back.
Thanks.Few years ago we were not existing and few years to come we would be in the grave! So what will benefit us in the grave?0 -
Thanks a lot guys...
Its working perfect.Few years ago we were not existing and few years to come we would be in the grave! So what will benefit us in the grave?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
