Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!
SOLVED

Adding days

Avatar

Level 4

Hi All,

 

I am using the 'formatDate' to get the current date, but I would also like to add 60 days to the current date. 

<%= formatDate(new Date(), "%2M/%2D/%4Y") %>

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @StrawHatM23,

 

You can have a content block with this code and see if that helps,

 

<%
var date = new Date();
// Add x days to specified date
date.setDate(date.getDate() + 60);
var newdate = ("0"+(date.getMonth()+1)).slice(-2) + "/" + ("0" + date.getDate()).slice(-2) + "/" + date.getFullYear();
document.write(newdate);
%>

 

Output: 03/24/2023

 

Thanks!

Thanks, Sathees

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @StrawHatM23,

 

You can have a content block with this code and see if that helps,

 

<%
var date = new Date();
// Add x days to specified date
date.setDate(date.getDate() + 60);
var newdate = ("0"+(date.getMonth()+1)).slice(-2) + "/" + ("0" + date.getDate()).slice(-2) + "/" + date.getFullYear();
document.write(newdate);
%>

 

Output: 03/24/2023

 

Thanks!

Thanks, Sathees