essentially, what I am doing is getting a date such as "4/18/1972" and regurgitating it properly formatted "April 18, 1972". I was able to get past the first hurdle,
Here's the code I have initially to build it:
System.out.print("Date: ");
receivedDate = user.next();
String receivedDateMonth = receivedDate.substring(0, receivedDate.indexOf("/"));
int receivedMonth = Integer.parseInt(receivedDateMonth);
if(month >= 1 && month <= 9)
{
String receivedDateDay = receivedDate.substring(2, receivedDate.indexOf("/"));
int day = Integer.parseInt(receivedDateDay);
System.out.println(day);
}
As I wrote it, I was testing to make sure receivedDateMonth appears properly and it did, but as I move onto the day, it doesn't work. I keep getting an error, "String index out of range: -1". I figure it's centered on the "2" there, so I changed its value and the problem persists. I put the 2 in because I wanted it to count from the first digit, 0, then the "/", with the intention of starting the next parse after that(I would change the 10-12 to do similar, go to 3), however, for the life of me, I cannot figure this out. Could someone please point me in the right direction? Thanks a lot.