특정 날짜와 현재 시간의 차이를 계산하고 싶습니다.두 날짜의 차이를 계산 한 후 잘못된 시간 받기
int month = 9;
int day = 17;
int year = 2013;
Calendar date = new GregorianCalendar(year, month, day);
int miliseconds= (int) (System.currentTimeMillis() - calendar.getTimeInMillis());
System.out.println(msToString(second));
String msToString(int ms) {
return (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")).format(new Date(ms));
}
출력
13091-13091 /인가? D/GTA : 1970-01-08 15 : 00 : 20.287
남은 일, 시간, 분 및 초를 가져오고 싶습니다.
무엇이 잘못 되었나요?
은 'second'밀리 초가 아닙니다. –
확실히 처음 몇 초 였지만 변수를 변경하지 않았습니다. –