SimpleDateFormat

Calendar calendar = Calendar.getInstance();
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss");
		String currentTime = dateFormat.format(calendar.getTime());
		System.out.println(currentTime);
输出:20160306_154947

你可能感兴趣的:(SimpleDateFormat)