Discussions
Activity
Best Of...
Sign In
·
Register
Home
›
NAV/Navision Classic Client
Howdy, Stranger!
It looks like you're new here. Sign in or register to get started.
Sign In
Register
Quick Links
Categories
Recent Discussions
Activity
Best Of...
Unanswered
Categories
All Categories
73
General
73
Announcements
66.7K
Microsoft Dynamics NAV
18.7K
NAV Three Tier
38.4K
NAV/Navision Classic Client
3.6K
Navision Attain
2.4K
Navision Financials
115
Navision DOS
854
Navision e-Commerce
1K
NAV Tips & Tricks
772
NAV Dutch speaking only
615
NAV Courses, Exams & Certification
2K
Microsoft Dynamics-Other
1.5K
Dynamics AX
318
Dynamics CRM
109
Dynamics GP
10
Dynamics SL
1.5K
Other
993
SQL General
385
SQL Performance
34
SQL Tips & Tricks
34
Design Patterns (General & Best Practices)
Architectural Patterns
10
Design Patterns
5
Implementation Patterns
53
3rd Party Products, Services & Events
1.6K
General
1.1K
General Chat
1.6K
Website
79
Testing
1.2K
Download section
23
How Tos section
260
Feedback
12
NAV TechDays 2013 Sessions
13
NAV TechDays 2012 Sessions
Date functions
sunct
Member
Posts:
72
2008-03-28
edited 2008-03-29
in
NAV/Navision Classic Client
Hello,
I am having a requirement... if you enter any date in the system, the last date of that month should be populated automatically..
any one can help?
Thxs and regds
Regards,
Sunil
0
Comments
garak
Member
Posts:
3,263
2008-03-28
take a look to the systemfunction: (System -> Date -> Calcdate
NewDate := CALCDATE(DateExpression [, Date])
This function (and an help for this) you can find when using C/AL Symbol Menu (F5 in designmode) and press then F1
Regards
Do you make it right, it works too!
0
JedrzejT
Member
Posts:
267
2008-03-28
I do it by this function
LastMonthDayOfDate(pDate : Date) : Date
DateRec.SETRANGE(DateRec."Period Type",DateRec."Period Type"::Month);
DateRec.SETRANGE(DateRec."Period Start",DMY2DATE(1,
DATE2DMY(pDate,2),
DATE2DMY(pDate,3)));
DateRec.FIND('-');
EXIT(NORMALDATE(DateRec."Period End"));
0
sunct
Member
Posts:
72
2008-03-28
Thanx a lot ... It helped me!
Regds
Regards,
Sunil
0
garak
Member
Posts:
3,263
2008-03-28
use Calcdate. You need no new function :!:
EndDateMonth := calcdate('<CM>',today)
Do you make it right, it works too!
0
DenSter
Member
Posts:
8,307
2008-03-28
So jujst to elaborate a little:
"CM" gets you the last day of the month of the date that you passed into CALCDATE.
"-CM" gets you the first day of the month of the date that you pass into CALCDATE
the "<" and ">" around the dateformula is to make the system language independent
Daniel Rimmelzwaan
RIS Plus, LLC
0
JedrzejT
Member
Posts:
267
2008-03-28
Hi,
Good to know. I use calcdate only to plus or minus some period to date. Good to read help sometimes. ](*,)
Regards.
0
garak
Member
Posts:
3,263
2008-03-28
jupp, sometimes, the "Help" will help :whistle:
Do you make it right, it works too!
0
DenSter
Member
Posts:
8,307
2008-03-28
Also, the first stop for syntax should be the C/SIDE reference guide, from the help menu. It has an excellent search function.
Daniel Rimmelzwaan
RIS Plus, LLC
0
garak
Member
Posts:
3,263
2008-03-29
thats right. Every person, who is new (or old) on NAV, should be use the help (F1) after this, search the forum, there are many questions and answers, or tell us your question. But first: Use help and your brain. [-o<
These are no angry words 8)
So, good night
Do you make it right, it works too!
0
Sign In
or
Register
to comment.
Comments
NewDate := CALCDATE(DateExpression [, Date])
This function (and an help for this) you can find when using C/AL Symbol Menu (F5 in designmode) and press then F1
Regards
LastMonthDayOfDate(pDate : Date) : Date
DateRec.SETRANGE(DateRec."Period Type",DateRec."Period Type"::Month);
DateRec.SETRANGE(DateRec."Period Start",DMY2DATE(1,
DATE2DMY(pDate,2),
DATE2DMY(pDate,3)));
DateRec.FIND('-');
EXIT(NORMALDATE(DateRec."Period End"));
Regds
Sunil
EndDateMonth := calcdate('<CM>',today)
RIS Plus, LLC
Good to know. I use calcdate only to plus or minus some period to date. Good to read help sometimes. ](*,)
Regards.
RIS Plus, LLC
These are no angry words 8)
So, good night