转载:http://af8991.iteye.com/blog/1217672
new SimpleDateFormat("yyyyMMddHHmmssSSS") .format(new Date() );
方法2:
Calendar Cld = Calendar.getInstance();
int YY = Cld.get(Calendar.YEAR) ;
int MM = Cld.get(Calendar.MONTH)+1;
int DD = Cld.get(Calendar.DATE);
int HH = Cld.get(Calendar.HOUR_OF_DAY);
int mm = Cld.get(Calendar.MINUTE);
int SS = Cld.get(Calendar.SECOND);
int MI = Cld.get(Calendar.MILLISECOND);
String curTime = YY + MM + DD + HH + mm + SS + MI;
Calendar cal = Calendar.getInstance();
java.util.Date date = cal.getTime();
SimpleDateFormat sdFormat = new SimpleDateFormat("yyyyMMddhhmmssSSS");
String myTime = sdFormat.format(currentTime);
时间: 2024-11-04 01:54:03