Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Adding days to a given date to output a new date?

Avatar

Former Community Member

Hello all, I'm trying to figure out how to add days from a given input date to output a new date,

For example, the user enters the date in Cell 1, and Cell 2 will output whatever date is 3 days later.

Row1Cell2 = Row1.Cell1 + (3 days).

So for example, if I enter June 26, 2012, the output would be June 29, 2012...or if I enter June 29, 2012 the output would be July 2, 2012.

What is the correct syntax to use to produce this result?

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can put this script on the Exit event of your Cell1 (script is FormCalc):

var nDate = Date2Num($,"YYYY-MM-DD")

Cell2 = Num2Date(nDate + 3, "YYYY-MM-DD")

Your date format should take on whatever date pattern you have set but you might need to change the date patterns above to match what you need.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

You can put this script on the Exit event of your Cell1 (script is FormCalc):

var nDate = Date2Num($,"YYYY-MM-DD")

Cell2 = Num2Date(nDate + 3, "YYYY-MM-DD")

Your date format should take on whatever date pattern you have set but you might need to change the date patterns above to match what you need.