X1628: Convert date from ISO to US

Write the method String convertDate(String name) in Java that implements the following logic: Given a data in string format in the form of "2026-02-14" (ISO format), return a string for the same date for in the format "02/14/2026".

You can assume that the year is always 4 digits, and month and day are always 2 digits.

You may consult the Java String class to help you solve this problem.

Examples:

convertDate("2026-02-14") -> "02/14/2026"

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.