이 블로그 검색

2014년 11월 22일 토요일

Java 날짜 및 시간 처리


Calendar today = Calendar.getInstance();

int year = today.get(Calendar.YEAR);
int month = today.get(Calendar.MONTH);
int day = today.get(Calendar.DAY_OF_MONTH);
int hour = today.get(Calendar.HOUR_OF_DAY);

today.setTime(new Date(System.currentTimeMillis()+ 3600000));
// 지금으로부터 1시간 후로 시간 세팅