I''m trying to get a numerical representation of a date for the purpose of comparing two dates, so for example, if graduation date is > Start Date AND graduation Date < End Date - something like that.
I've had a look everywhere on stackoverflow and have not found anything that addresses my particular problem.
This is the error I'm currently getting:
java.lang.IllegalArgumentException: Parse error: 2017-01-13
at java.util.Date.parseError(Date.java:367)
at java.util.Date.parse(Date.java:448)
at java.util.Date.<init>(Date.java:157)
This is the code that I am running:
for(int i =0; i< ParseJSONNotif.getEC().length; i++) {
d[i] = pj.getDateConsumed()[i];
System.out.println("DATES ARE IN STRING FORMAT");
System.out.println("THESE ARE THE DATES: " + d[i]);;
Date ddj = new Date(d[i]);
ecdates[i] = ddj.getTime();
System.out.println("THESE ARE THE ECDATES: " + ecdates[i]);
The problem is obviously occurring on the following line: Date ddj = new Date(d[i]); As its unable to parse the following date: 2017-01-13
So how would i get a numerical representation/value for that date? As mentioned before, I need it for the purpose of comparing dates.
Thanks in advance!