0

is there a solution how to code the analog of the excel EDATE function in ninox?

let curr_date:=date(2019,1,31)

if I use the following formula for the next_date which is a month later:

next_date = date (year(curr_date), month(curr_date)+1, day(curr_date)) it returns a date in March

Q: in general, how to cope with inequality of day numbers in different calendar months? is there the "EDATE" excel analog function?

10 replies

null
    • Mconneen
    • 4 yrs ago
    • Reported - view

    Well.. this is not exact.. but as close as I could get within the alotted timebox.   You can keep playing with the logic.. or perhaps others have a better solution ...   I do recall support telling me about some hidden functions.. I thought there was a mod type function .. but cannot find it.   Also.. my leap year is wrong.. I did not bother to check if it is a century marker year divisable by 100. 

    functionCode

    • Mconneen
    • 4 yrs ago
    • Reported - view

    oops..   This is a bit closer. 

    functionCode

    • Sean
    • 4 yrs ago
    • Reported - view

    @Mconneen, the undocumented mod operator is:  %

    • Mconneen
    • 4 yrs ago
    • Reported - view

    @Sean.. I need to keep better notes!   Thanks a bunch!!

    • to be defined
    • serik
    • 4 yrs ago
    • Reported - view

    thanks a lot. your idea helped me to understand how to cope with the number of days in months.

    I found a solution similar to youth. it works pretty well with negative months as well as with leap years.

     

    Screen Shot 2020-06-02 at 20.18.07

    • to be defined
    • serik
    • 4 yrs ago
    • Reported - view

    @Sean. thanks for %, it works

    • Ninox partner
    • RoSoft_Steven.1
    • 4 yrs ago
    • Reported - view

    @Sean or @Mconneen mod type function? Am I missing something? Can you explain or give an example please? 

    • Mconneen
    • 4 yrs ago
    • Reported - view

    @serik

    I like it!

    • Sean
    • 4 yrs ago
    • Reported - view

    @Steven, the modulo operator returns the remainder of a division operation.

     

    13 % 7 = 6

    13 % 6 = 1

    • Ninox partner
    • RoSoft_Steven.1
    • 4 yrs ago
    • Reported - view

    Oh, thanks. @Sean, good to know. @Serik, nice programming.

Content aside

  • 4 yrs agoLast active
  • 10Replies
  • 1444Views