import java.util.*; import java.text.SimpleDateFormat; int y,m,d,h,mi,s,ms; String cur; Calendar cal=Calendar.getInstance(); y=cal.get(Calendar.YEAR); m=cal.get(Calendar.MONTH)+1; d=cal.get(Calendar.DATE); h=cal.get(Calendar.HOUR_OF_DAY); mi=cal.get(Calendar.MINUTE); s=cal.get(Calendar.SECOND); ms=cal.get(Calendar.MILLISECOND); System.out.println("The current time is:"+y+"/"+m+"/"+d+"/"+h+"/"+mi+"/"+s+"/"+ms); vars.put("Date",m+"/"+d+"/"+y); /** 输出格式: 20060101010101001**/ java.text.DateFormat format1 = new java.text.SimpleDateFormat("yyyyMMddhhmmssSSS"); cur=format1.format(new Date()); System.out.println(cur); vars.put("CurrentTime",cur);