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));
结果:
时间: 2024-10-10 15:54:53
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));
结果: