import java.util.*;
import java.text.*;
public class parseDate {
public static void main(String args[]) {
SimpleDateFormat a = new SimpleDateFormat("yyyy-MM-dd");
String input = args.length == 0 ? "1978-12-20" : args[0]; // enter the date to know the day
System.out.print(input + "Parses as");
Date t;
try {
t=a.parse(input);
System.out.println(t);
}
catch (ParseException e) {
System.out.println("Unparseable using " + a);
}
}
}
import java.text.*;
public class parseDate {
public static void main(String args[]) {
SimpleDateFormat a = new SimpleDateFormat("yyyy-MM-dd");
String input = args.length == 0 ? "1978-12-20" : args[0]; // enter the date to know the day
System.out.print(input + "Parses as");
Date t;
try {
t=a.parse(input);
System.out.println(t);
}
catch (ParseException e) {
System.out.println("Unparseable using " + a);
}
}
}
No comments:
Post a Comment