I am adding days to the current date but I am getting an invalid date in the result.
I am using BeanShellPreprocessor in Jmeter and using following code to get the current date.
import java.text.SimpleDateFormat;
import java.util.Date;
Date date = new Date();
date.setDate(date.getDate()+15);
SimpleDateFormat df = new SimpleDateFormat("MM/DD/YYYY HH:mm a");
String formattedDate = df.format(date);
vars.put("slotFirstCall",formattedDate);
This code is adding 15 days to the current date but the value I am getting in the variable is 02/33/2018. And it is showing a different date on the calendar. Date on the calendar, where I am using it is 03/05/2018.
If I use this code in Java I get the correct result, but in Jmeter I get the invalid date.