3
I’m trying to make a conversion of String
for Calendar
but without success.
My String is in dd/MM/yyyy format.
I need to convert to yyyy-MM-dd
And set on an object of type Calendar
.
void setDATAFUNDACAO(java.util.Calendar value);
Here’s my current code:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = sdf.parse("07/04/2016");
Calendar cal = sdf.getCalendar();
But unfortunately he launches this exception
Exception in thread "main" java.text.Parseexception: Unparseable date: "07/04/2016" at java.text.Dateformat.parse(Dateformat.java:337) at test.main(test.java:54)
I’ll test it here. In the morning. VLW
– Carlos Baraúna