Date date2=new Date();
DateFormat df=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss" );
String str=df.format(date2);
System.out.println(str);
这里注意区分MM与mm的书写,MM表示月,mm表示分钟,大小写一定要注意!
DateFormat df=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss" );
String str=df.format(date2);
System.out.println(str);
这里注意区分MM与mm的书写,MM表示月,mm表示分钟,大小写一定要注意!