日期:2014-05-17 浏览次数:20733 次
public String gettime() { Calendar cal=Calendar.getInstance(); int year=cal.get(Calendar.YEAR); int month=cal.get(Calendar.MONTH); int date=cal.get(Calendar.DAY_OF_MONTH); int hour=cal.get(Calendar.HOUR_OF_DAY); int minute=cal.get(Calendar.MINUTE); String year1=String.valueOf(year); String month1=String.valueOf(month); String date1=String.valueOf(date); String hour1=String.valueOf(hour); String minute1=String.valueOf(minute); return (year1+"-"+month1+"-"+date1+" "+hour1+":"+minute1); }
public String gettime() { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");//设置日期格式 return df.format(new Date());// new Date()为获取当前系统时间 }