将System.currentTimeMillis()转换为日期

private void date(){
		long currentTimeMillis=System.currentTimeMillis();
		System.setProperty("user.timezone", "Asia/Shanghai");  
		TimeZone timeZone = TimeZone.getTimeZone("Asia/Shanghai");  
		TimeZone.setDefault(timeZone);  
		SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
		Date currentDate=new Date(currentTimeMillis);
		String currentTime = simpleDateFormat.format(currentDate);  
        System.out.println("currentTime="+currentTime);
	}

你可能感兴趣的:(将System.currentTimeMillis()转换为日期)