I am trying to convert a Joda Date time to a string in "MM/dd/yyyy" so I can do a sendKeys.
Below is the code I am using:
//Enter an IRB Expiration Date
WebElement irbExpCP = driver.findElement(By.id("irbExpDate"));
irbExpCP.click();
String irbDate = dt.now().plusYears(5).toString();
DateTimeFormatter formatter = DateTimeFormat.forPattern("MM/dd/yyyy");
String irbDate2 = formatter.parseLocalDate(irbDate).toString();
irbExpCP.sendKeys(irbDate2);
When I run through this I am getting the following error:
`java.lang.IllegalArgumentException: Invalid format: "2018-05-30" is malformed at "18-05-30"'
I have looked at several different questions here as well as the joda DateTimeFormatter page to no avail. I just need to have the date in the MM/dd/yyyy format. What am I doing wrong?