JAVA: Create a program that accepts dates in numerical form and then output them as a complete form. For example, In Terminal, i input: 02/26/1986 and i enter should produce the the output: Feb 26,1986. Pls Help me what is the code?
Asked
Active
Viewed 51 times
-5
-
http://developer.android.com/reference/java/text/SimpleDateFormat.html This has the answers to your question. Scroll a bit down and see the usage of Simple Date Format. – Varun Agarwal Oct 07 '15 at 04:25
1 Answers
-1
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.time.format.DateTimeFormatter;
final class SO32983650
{
private static final DateTimeFormatter parser = DateTimeFormatter.ofPattern("M/d/uuuu");
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMM dd, uuuu");
public static void main(String... argv)
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
in.lines().map(parser::parse).map(formatter::format).forEach(System.out::println);
}
}

erickson
- 265,237
- 58
- 395
- 493