How to get the days in and date difference.

web
Member Posts: 102
Hi,
I am subtracting between to dates. I get something like 30.65. 30 is in months and .65 in days.
I am trying to add a logic that will take this on board.
from 0-20 days should be 0 month and 21 above should be 1 month.
Can anyone help me with this please.
Thanks
I am subtracting between to dates. I get something like 30.65. 30 is in months and .65 in days.
I am trying to add a logic that will take this on board.
from 0-20 days should be 0 month and 21 above should be 1 month.
Can anyone help me with this please.
Thanks
0
Comments
-
web wrote:I am trying to add a logic that will take this on board.0
-
I mean how can i take the decimal part of my date difference which is i months and day( i.e 30.40) to have the decimal which is days to take 0-20 day to 0month and 21 above to 1 month.
I hope this is clear?
Thanks0 -
this is not clear
what exactly your 30.40 means ?
30 months and 40 days ?
does 30 months mean 30*30 days ? do you want your month to be 20 days long so that 30 months is equal to 30*20 days ?
explain to us what format you are using0 -
I'd probably multiply the decimal by 100, then put it into a text variable, copy the last 2 digits, evaluate that into an integer, and then create a little function that looks at the value and returns 0 or 1 depending on the value.
I'm still unclear about the decimal though. Your example was 30.65. Taking the decimal part out of that you'd have 65, which in calendar days would be well over two months. By your logic it would be just 1 month, because it's higher than 21. How are you going to handle that?0 -
The number of days in a month will be exactly as in the respective months. But where we have .17 needs to be converted to days and if it is ,21 days it returns zero otherwise it should return 1 month.
sorry for giving .65 as example. it is really a bad example i gave. So for bothering you because i am learning programming.
Thanks0 -
If you're trying to extract decimal or whole number use the following,
Variable1 DIV Variable2 := WholeNumber; Variable1 MOD Variable2 := FloatingPointNumber;
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 320 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