时间格式化
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date;
public static void main(String [] args){
Date date=new Date();
System.out.println(date);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd:hh:mm:ss");
System.out.println(sdf.format(date));
System.out.println(sdf2.format(date));
}