How do i increment date from today by X days

I was trying to increment a date by 30 days → Creating a coupon code with which subscription can be added for extra 30days from today; I have a column which has todays date; I tried incrementing it by number 30 - But finally it is showing 29-Jan-1900;

Can someone help me how to increment this column date by 30 days ? or 7 days ? or x days whichever i would like to set

You can use a math column to add a number of days to a date.

1 Like

Is there no other way to add within Action itself ?

This is the way i tried

I suspect that incrementing a date by a number just doesn’t translate well because to the different data types (date vs numeric). When you do date math with a math column, then glide knows that adding 30 to a date means you want to add 30 DAYS to that date.

If it has to be through an action, I would probably precalculate the date+30 in a math column, and then apply that new date through a set column action.

2 Likes

Thanks… Right Now i am trying out your solution, it is working.

I am left wondering if there is an easier way, instead of having a math column for all my columns being added(entire set of maths done - basically wasting resources) just for this use case of incrementing dates

1 Like

I don’t ever recall anybody ever trying to apply an increment to a date column, so it’s probably just something that was never thought of before. It’s a good idea though.

2 Likes

Slight tangent here, but I can’t help noticing the hard-coded coupon code at the start of your action.
Is that something that would ever change? It looks like it probably will change - maybe next month?
If that is the case, it’s going to mean you have to modify your app every time you change it, and hope that all your users get the correct version.

Would you ever have more than one valid coupon code at the same time? If yes, how would you deal with that?

Where I’m going with this is that you might find it better to have a list of valid codes stored in a column somewhere, and compare the entered code to those, rather than hard coding a single value.

2 Likes