Code doesn't pass testing. With or without try and catch.

public class Solution {

    public static void main(String[] args) throws Exception {
        //add your code here
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        SimpleDateFormat format = new SimpleDateFormat(
                "MM/dd/yyyy");

        try
        {
            Date date = format.parse(s);
            SimpleDateFormat format2 = new SimpleDateFormat(
                    "MMM dd, yyyy", Locale.US);
            String reportDate = format2.format(date);
            System.out.println(reportDate);
        }
        catch (ParseException e)
        {

        }

    }
}

asked 06 Aug '17, 11:45

genek's gravatar image

genek
176
accept rate: 0%


"Display to the screen that date in the form of «AUG 18, 2013»."

You should use toUpperCase method to convert the name of a month in your String to upper case.

link

answered 16 Aug '17, 05:08

pa_patki's gravatar image

pa_patki
1
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×14
×11
×10

Asked: 06 Aug '17, 11:45

Seen: 532 times

Last updated: 16 Aug '17, 05:08