End of Month

sabzamsabzam Member Posts: 1,149
edited 2008-07-07 in Navision Financials
Hi Everybody,

I need to get the end of month for a date provided. Is this possible with Navision.

I'm assuming that I should use ROUNDDATETIME but I'm not sure how to use it.

Answers

  • krikikriki Member, Moderator Posts: 9,110
    datEndOfMonth := CALCDATE('<CM>',datSomeDate);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • DenSterDenSter Member Posts: 8,305
    And start of the month:
    datStartOfMonth := CALCDATE('<-CM>',datSomeDate);
    
  • AsallaiAsallai Member Posts: 141
    Do you mean the Last Day of a month?

    Input: dateValue
    Output: dateLast
    IF DATE2DMY(dateValue,2) < 12 THEN
    dateLast:=DMY2DATE(1,DATE2DMY(dateValue,2)+1,DATE2DMY(dateValue,3))
    ELSE
     dateLast := DMY2DATE(1,1,DATE2DMY(dateValue,3)+1);
    dateLast := CALCDATE('-1D',dateLast);
    
  • DenSterDenSter Member Posts: 8,305
    Asallai wrote:
    Do you mean the Last Day of a month?
    Yes that is what he meant, and you do not need that much code, there is a very simple CALCDATE commend for that:
    kriki wrote:
    datEndOfMonth := CALCDATE('<CM>',datSomeDate);
    
  • AsallaiAsallai Member Posts: 141
    DenSter wrote:
    Asallai wrote:
    Do you mean the Last Day of a month?
    Yes that is what he meant, and you do not need that much code, there is a very simple CALCDATE commend for that:
    kriki wrote:
    datEndOfMonth := CALCDATE('<CM>',datSomeDate);
    

    Thanks! Better late then never! :lol:
  • sabzamsabzam Member Posts: 1,149
    Thanks Kriki, problem solved!
Sign In or Register to comment.