0

Calculate new date by adding months to an existing date

I have gone through some of the posts and tried to use the syntax but don't seem to get it right.

I want to add the number of months (Fieldname Tenancy Period) to date field Tenancy Start Date into a new formula field Tenancy End using this:

date(year('Tenancy Start Date'), month('Tenancy Start Date') + number('Tenancy Period'), day('Tenancy Start Date'))

No error shown on the script but the result is strange.

 

Not sure if you can see the image below but the result in the Tenancy End field is 1672502400000, not a date at all!  Where have I gone wrong?

ninox date

2 replies

null
    • Infinite Wealth Potential Pte Ltd
    • Yip_Lee_Fun
    • 3 yrs ago
    • Reported - view

    I wonder if there is a bug.  I use this:

    date(date(year('Tenancy Start Date'), month('Tenancy Start Date') + number('Tenancy Period'), day('Tenancy Start Date')))

    The date return in the table view is correct but not on the form view.

    chrome_ABlSi8fCLc

    • Infinite Wealth Potential Pte Ltd
    • Yip_Lee_Fun
    • 3 yrs ago
    • Reported - view

    Ok, I got it.  The field is corrupted.  I delete and recreate and it is working now.