Read Customer Stories
Digitization boosts DeRock Electric’s operations, efficiency, and profitability.
Built a a HIPAA-Compliant Start-Up and saved $250k+ saved/year.
Try Interactive Demo
No-code database platforms are transforming the way web apps are…
Template Marketplace
Supercharge your Work Order Management by managing work orders, assigning…
Supercharge your Work Order Management by managing work orders, assigning…

How to Automatically Capture an End Date

Related Posts

Hi, everyone. Roe here from Knack. Today, I’m going to show you how to automatically capture an end date in your app.

We’re diving right into my Document Manager example. Let’s say I’m entering documents that have a start date and an expiration date. I’ll go ahead and enter a document using today as the start date.

You’ll see that the new record I just entered has a start date of 5/27/2021 and an expiration date of 5/27/2022.

So, how did I do that? How did I automatically calculate the expiration date by only entering the start date?

Setting Up the Expiration Date with an Equation Field

That’s done using an equation field. Let’s jump into the Builder to see how it’s set up.

In the Builder, we’re on the Schema tab, looking at the Document object I’ve already created. This object includes:

  • A short text field for the document name
  • A date field to capture the start date
  • An equation field that calculates the expiration date

Let’s take a closer look at that expiration date equation field.

Key Settings for the Expiration Date Field

Here are a few important configurations to note:

  1. Equation Type:
    Set this to Date. By default, Knack sets it to numeric, but since we’re working with dates, we want it to calculate a date value.
  2. Date Type:
    This determines the time unit. In my example, I’m calculating one year ahead. You can also choose days, weeks, or hours, depending on your use case.
    • For a 14-day trial, select days
    • For a two-week trial, select weeks
  3. Result Type:
    This is the format of the output. You can choose between a number or a full date. In this case, we want to see a full date—so the result type is set to Date.
  4. Equation Editor:
    This is where the actual math happens.
    • Choose the Start Date field
    • Simply add 1 (since we’re calculating one year ahead)

And that’s it! Once this is configured, the expiration date will be calculated automatically every time a new document is created.

Demo: Viewing the Results in the App

Now that everything is set, I can enter a new document with a start date, and the app will calculate the expiration date as one year out. You can test this by choosing any start date, submitting the form, and verifying the output.

Bonus: Handling Variable Expiration Dates

Let’s look at another scenario—what if the expiration date varies? Maybe you want to enter:

  • 14 days for one document
  • 30 days for another
  • 7 days for a third

This is possible in Knack too. Here’s how:

  1. Add a Number Field:
    This new field captures the number of days for each document’s expiration period.
  2. Update the Equation Field:
    • Set the Equation Type to Date
    • Choose Days as the unit
    • Output should still be set to Date
    • Use the formula:
      Start Date + Number of Days

Now, when you enter a start date and the number of days, Knack will calculate the expiration date based on your input.

Final Test Example

Let’s add a test record:

  • Start Date: Today
  • Number of Days: 14

Once submitted, the expiration date will be calculated as 6/10, exactly 14 days after 5/27.

You can enter any number of days and Knack will update the expiration date accordingly.

Wrap-Up and Support

And that’s it! You now know two ways to set up automatic expiration dates in Knack—either as a fixed value (e.g., one year) or as a variable based on user input.

I hope this helps! If you have any questions, feel free to reach out to us at support@knack.com.

Thanks for joining me.