import java.text.SimpleDateFormat;
import java.util.Date;
public class Test{
public static void main(String[] args){
//使用格式说明符格式化日期
//格式化日期:新的写法
Date date=new Date();
String yearMonthDay=String.format("%tF",date);
String hourMinuteSecond=String.format("%tT",date);
System.out.println("现在是:"+yearMonthDay+" "+hourMinuteSecond);
System.out.println("===================================");
//使用熟悉的格式化字符串的方法
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String fullTime=sdf.format(date);
System.out.print("现在是:"+fullTime);
}
}