Java에서 현재 시스템 시간 (타임 스탬프) 가져 오기

JAVA에서 현재 시스템 시간 가져 오기

코드 및 스크린 샷 직접 업로드 

public static void main(String[] args) {

		// 当前时间戳
		System.out.println(System.currentTimeMillis());

		// 参考https://www.cnblogs.com/cai662009/p/8074310.html
		Date now = new Date();
		// 可以方便地修改日期格式
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");

		String currentDate = dateFormat.format(now);
		System.out.println(currentDate);

        SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

		String currentDate2 = dateFormat2.format(now);
		System.out.println(currentDate2);

	}

작업 결과는 다음과 같습니다.

추천

출처blog.csdn.net/czh500/article/details/114892004