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

Add days to date

Avatar

Level 3

Hello,

I'm sure this is something simple I am missing :-)

Here is the js I am using.  

var dateToNumber = Date2Num(form1.page2.page2Date.rawValue, "MM/DD/YYYY");

var datePlusDays = dateToNumber + firstRowWeek.rawValue * 7;

var boosterDate = Num2Date(datePlusDays, "MM/DD/YYYY");

form1.page2.invoiceTable.row1.boosterDate1.rawValue = boosterDate;

All I am trying to do is take a date and add some days to it depending on what someone selects from a dropdown.  The date I am using is from the

 

$.rawValue = num2date(Date(), "MM/DD/YYYY")

I'm not sure why I can't get this to work properly.  Any help would be much appreciated.

Justin

1 Accepted Solution

Avatar

Correct answer by
Level 10

This could be done this way:

$ = Num2Date(Date2Num(form1.page2.page2Date.formattedValue, "MM/DD/YYYY") + firstRowWeek * 7, "MM/DD/YYYY")

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

This could be done this way:

$ = Num2Date(Date2Num(form1.page2.page2Date.formattedValue, "MM/DD/YYYY") + firstRowWeek * 7, "MM/DD/YYYY")

Avatar

Level 3

OMG!!!!!!!!!!!!!!!!!!!!!  I just realized Num2Date and Date2Num are Formcalc funations!!!!!!!!!!!!!  WOW!!!!!  That was dumb lol 

I'm going to need to look into formattedValue also it looks like when displaying dates/times.

THANK YOU FOR YOUR HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!