Thursday, 21 September 2023

How to get currentDate+1day (Tomorrow's date) in m/dd/yyyy format in postman

In Postman Tests section write below code. 

const currentDate = new Date();

currentDate.setDate(currentDate.getDate() + 1);

const formattedDate = `${currentDate.getMonth() + 1}/${currentDate.getDate()}/${currentDate.getFullYear()}`;

console.log(formattedDate);




Example : 

If today's date is 9/21/2023 then we get 9/22/2023 in the console log.

No comments:

Post a Comment