Showing the day + month in two weeks

I’m prototyping a flow where the user can try out a service free for two weeks. I want to display the day + month when the trial ends.

At first, I was getting getting the day, month and year and store them all in separate values. But after a couple of hours of not getting nowwhere, I thought that there has to be a simpler way to do this.

So I came a cross the getTime function. That returns the amount of milliseconds passed. My idea now is to add two weeks worth of milliseconds (12096e5) and store that. But I’m wondering if this is even the right approach to begin with. Before I sink another couple of hours in it: am I heading in the right direction?

You can get the date two weeks from the current date like this:

[[Now.addDays(14)]]
gives: Mon Apr 15 2019 08:52:22 GMT-0500 (Central Daylight Time)

With that you can do all the usual date manipulation stuff.

[[Now.addDays(14).getDayOfWeek()]], [[Now.addDays(14).getMonthName()]] [[Now.addDays(14).getDate()]]
gives: Monday, April 15

That’s even better! Totally missed the addDays. Thanks mate!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.