How to Calculate ??

navuser1navuser1 Member Posts: 1,329
Hi All,

Please share your knowledge..........

How to calculate Starting Date & Ending Date from
the Specified(given) Year And Month ?


Like that......

User input

Year := 2008
Month := April

Result (Output)

Startig Date := 01/04/08
Ending Date := 30/04/08
Now or Never

Comments

  • kinekine Member Posts: 12,562
    edited 2008-10-01
    You can use the virtual table "Date" to filter for period type Month, filter for all dates from the correct year and filter for the correct month and you will have start and end date.

    Or you can use something like
      StartDate := DMY2DATE(1,MyMonth,MyYear);
      EndDate := CALCDATE('<+CM>',StartDate);
    

    Edit: typing error corrected
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • navuser1navuser1 Member Posts: 1,329
    Thnx...Kine !!

    Yes, I have used the Date Table to Solve the issue.
    But Your next Tips is fine...
    Now or Never
  • navuser1navuser1 Member Posts: 1,329
    kine wrote:
    You can use the virtual table "Date" to filter for period type Month, filter for all dates from the correct year and filter for the correct month and you will have start and end date.

    Or you can use something like
      StartDate := DMY2DATE(2,MyMonth,MyYear);
      EndDate := CALCDATE('<+CM>',StartDate);
    

    [*]....[*]
    StartDate should be....
      StartDate := DMY2DATE(1,MyMonth,MyYear);
    
    Now or Never
  • garakgarak Member Posts: 3,263
    Example
    message('Start = %1',format(calcdate('<-CM>',DMY2DATE(23,12,1977))));
    message('END = %1',format(calcdate('<CM>',DMY2DATE(03,12,1977))));
    
    Do you make it right, it works too!
  • navuser1navuser1 Member Posts: 1,329
    Great !!
    Now or Never
  • krikikriki Member, Moderator Posts: 9,110
    [Can you change the attribute of the topic to <Solved> (or also <Good Posting>) and remove the text from the title?]
    Please see Forum Rule(s) #3.9: Forum Rules.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.