import java.text.DateFormat;
import org.junit.Test;
import java.util.Date;
@Test
public void sss(){
System.out.println(DateFormat.getDateTimeInstance().format(new Date()));
}
2019-3-22 14:47:55
@Test
public void sss(){
System.out.println(DateFormat.getDateInstance().format(new Date()));
}
2019-3-22
@Test
public void sss(){
System.out.println(DateFormat.getTimeInstance().format(new Date()));
}
11:08:20
@Test
public void sss(){
System.out.println(DateFormat.getInstance().format(new Date()));
}
19-3-26 上午11:10
import java.text.SimpleDateFormat;
import java.util.Date;
@Test
public void d(){
System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new Date()));
}
yyyy-MM-dd HH:mm:ss
System.out.println(System.currentTimeMillis());
System.out.println(new Date().getTime());
1553568915029
1553568915029
System.out.println(new SimpleDateFormat("yyyy-MM-dd E a HH:mm:ss").format(new Date()));
2019-03-26 星期二 上午 10:57:58
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.e1idc.net