方案1:
SimpleDateFormat c = new SimpleDateFormat("yyyy-MM-dd ");
Date a = new Date();
String b = (String)c.format(a);
System.out.print(b);
方案2:
Calendar temp = Calendar.getInstance();
Date currentDate=new Date(temp.getTimeInMillis());
Time currentTime=new Time(temp.getTimeInMillis());
String sqlTime=currentDate.toString()+" "+currentTime.toString();