Calculating Future Date

I am trying to calculate the date of a projection to display for our users. Right now I am using a math field to calculate how many months into the future it will be for that user to hit their goal (e.g. Today + 16.23 months).

How can I store that future date in a column?

You could write use a set column action, or a form, or several other methods to write that calculated math column date to another basic column in the same table. Or you could just save the current date to the the table, and then you can perform your math against that set date instead of calculating with Today/Now.

2 Likes

Thanks for the advice Jeff. I guess what I mean to say is that I am trying to figure out how to actually perform the calculation (today + x months).

OK, I assumed you were already doing the math since you mentioned you had a math column.

Can you explain how you come up with 16.23 month? Date math can get a little more tricky when you are trying to calculate Years or Months. Glide’s date math works best with Days. Definitely still doable, but t0 get the right result, we first need to understand your end goal. For example, are you looking for a specific day that’s 16 months from now (Today May 26th 2021 → Goal September 26th 2022), or are you looking for a specific day of the week (the nearest Wednesday in September 2022), or the beginning or end of the month (Sept 1, 2022 or Sept 30, 2022). Mainly the question is, why 16.23 months? What’s the significance of that number?

Great question. The number tells them when they will achieve the goal based on their current rate. For example, based on how much money they are saving each month, they will reach their savings goal in x months. For display purposes, showing them the month-year (ignoring the day) of when they will reach their goal is probably sufficient.

ok, so you’re doing some other calculations to come up with the number and just need it to be converted to a date? Does that number change dynamically every day, or is it hard set at the time that the goal was created? (If it dynamically changes, then we can calculated based on Today. If it’s a hard set number, then we would also need to origination date of the goal).

It’s dynamically updated as their financials will continue to change. Part of the purpose with displaying the goal date is for them to be encouraged to do even better and then see the date move forward as they increase their savings.

Take a look at these posts and see if that works for you.

Since you are working with months, you may want to replace the Year value with Months, but you will need to add a divide by 12 to convert it to years.

In the end, you will have a date in the future in that math column and you can then use additional math columns to split out Month(date) and Year(date), then use a template column to put it back together however you want.

3 Likes