I want to enter two dates into two fields where first date is current date and other has firstdate+3months. I wish to get this in a variable first and directly input it to those fields using sendkeys. How can this be achieved. I am using Java for Selenium.
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
public class DateTimeDisplay {
public static void main(String[] args) {
DateFormat dateFormat1 = new SimpleDateFormat("MM/dd/yyyy");
Date date = new Date();
String date1= dateFormat1.format(date);
System.out.println(date1);
}
}
Here say I want another string date2 which stores date1+3months. How do I achieve it.?