JAVA에서 현재시간 구하기
long time = System.currentTimeMillis();
SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
date.format(new Date(time));
시간 데이터 포맷은 마음대로 변경할 수 있는데, "20151123 14:10"으로 표기하고 싶다면 "YYYYMMdd hh:mm"으로 세팅하면 된다. 여기서 주의할 점은, 월(month)과 분(minute)는 같은 알파벳 'm'을 사용하므로 대/소문자로 구분하여 사용해야 한다.
JSP에서 현재시간 구하기
var curDate = new Date();
var curTime = curDate.getFullYear() + "-" + (curDate.getMonth() + 1) + "-" + curDate.getDate() + " " + curDate.getHours() + ":" + curDate.getMinutes() + ":" + curDate.getSeconds();
curTime을 가져다 사용하면 된다.
참고 사이트
[Java] 리스트의 중복을 제거하는 방법 - stream distinct (0) | 2022.01.10 |
---|---|
[Java][Websocket] org.springframework.beans.factory.BeanCreationException 에러 (0) | 2015.11.23 |
댓글 영역