If i input the Date "2013-08-18" the output is "DEC 31, 2013", after doing some debugging the error is happening on line 24 where i parse the string to a date variable.
Any idea why this is happening?
package com.codegym.task.task09.task0922;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
/*
What's today's date?
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
SimpleDateFormat dateFormat = new SimpleDateFormat("YYYY-MM-dd");
SimpleDateFormat newDateFormat = new SimpleDateFormat("MMM dd, YYYY", Locale.ENGLISH);
String stringDate = reader.readLine();
Date ymd = dateFormat.parse(stringDate);
System.out.println(newDateFormat.format(ymd).toUpperCase());
}
}