DaTeText2
import java.text.ParseException;
import java.util.Date;
import java.util.Date;
public class Text2 {
public static void main(String[] args) throws ParseException {
Date d = new Date();
String s = DateDemo1.dateToString(d, "h:mm a");
System.out.println(s);
String ss=DateDemo1.dateToString(d, "yyyy.MM.dd G 'at' HH:mm:ss z" );
System.out.println(ss);
String str ="2018.10.27";
Date d2=DateDemo1.stringToDate(str, "yyyy.MM.dd");
System.out.println(d2);
}
}
public static void main(String[] args) throws ParseException {
Date d = new Date();
String s = DateDemo1.dateToString(d, "h:mm a");
System.out.println(s);
String ss=DateDemo1.dateToString(d, "yyyy.MM.dd G 'at' HH:mm:ss z" );
System.out.println(ss);
String str ="2018.10.27";
Date d2=DateDemo1.stringToDate(str, "yyyy.MM.dd");
System.out.println(d2);
}
}