Converting DateFormula to Integer!!!

Hanen
Member Posts: 281
Hi,
How can I assign a field DateFormula to an integer field
Anyone can help please?????
How can I assign a field DateFormula to an integer field

Anyone can help please?????
Regards
Hanen TALBI
Hanen TALBI
0
Comments
-
Hi
You can convert a datetime like a "delta" integer:
something like:
i := calcdate('<1M>', today) - today
But if the calculation involve month, for example, can return strange result:
If today is 22 of may, + 1 Month the int result is 31 days.
But if today is 22 Feb. + 1 Month the int result is 28 days.
Bye
MatteoReno Sistemi Navision Developer0 -
Thanks but I have to get something like :
2M --> 60
45D --> 45
2Y --> 720
....................
Can you tel me how can I deal with that?
Regards
Hanen TALBI0 -
Hanen wrote:Thanks but I have to get something like :
2M --> 60
45D --> 45
2Y --> 720
....................
Can you tel me how can I deal with that?
as the post above describes - you're going to have problems with 2M since not all months are 30 days. If you need it to be 60 days you'll need to code that to 60 & 2Y = 730 not 720.0 -
You need to apply the formula to today's date, and then do the calculation
new date - today's
This will give you an integer, but as you've been advised you won't get 60 days when using 2M, it depends on the number of days of that particular month...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