Here is the code snippet I am working with:
SimpleDateFormat df = new SimpleDateFormat("dd/MM/YYYY");
Date dt = new Date();
Calendar cl = Calendar.getInstance();
cl.setTime(dt);
cl.add(Calendar.DAY_OF_YEAR, 21);
dt=cl.getTime();
String check_date = df.format(dt);
System.out.println("The departure date is " + check_date);
js.executeScript("document.getElementById('txtFromDatesFgt').value='check_date'");
After running this code, the date gets stored as a string and the result is displayed on the console. However, I am facing a challenge when trying to pass this string into .value=''
. How can I achieve this?