Import Org.testng.annotations.Test;
Import java.text.ParseException;
Import Java.text.SimpleDateFormat;
Import Java.util.Date;
public class TestDate {
@Test
public void test01 () throws ParseException {
Date dt= new Date ();
Long S=system.currenttimemillis ();
Long long1= 1533954986837L;
SimpleDateFormat DTF = new SimpleDateFormat ("Yyyy-mm-dd");
SimpleDateFormat DTF1 = new SimpleDateFormat ("Yyyy-mm-dd Hh:mm:[email protected]");
String sdate =dtf1.format (long1);
System.out.println (sdate);
System.out.println (Dtf.format (DT));
System.out.println (Dtf1.format (DT));
System.out.println (Dtf1.format (DT). toString ());
Date-String
Date date = new Date (System.currenttimemillis ());
System.out.println (Dtf.format (date));
String-Date
String timestring = "2018-08-11 11:44:27";
Date newdate = Dtf.parse (timestring);
System.out.println (newdate);
}
}
Java Medium Time processing system.currenttimemillis ()