yyyy-MM-dd与YYYY-MM-dd
Date date=new Date(); DateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:MM:SS"); DateFormat sdf1=new SimpleDateFormat("YYYY-MM-dd HH:MM:SS"); out.println(sdf.format(date)); out.println(sdf1.format(date));
结果:
Date date=new Date(); DateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:MM:SS"); DateFormat sdf1=new SimpleDateFormat("YYYY-MM-dd HH:MM:SS"); out.println(sdf.format(date)); out.println(sdf1.format(date));
结果: