문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 | |||
java:date [2017/06/29 18:11] kwon37xi [Date의 필드 수정] |
java:date [2017/06/29 18:12] kwon37xi [두 Date 객체간의 날짜 차이] |
||
---|---|---|---|
줄 25: | 줄 25: | ||
// getTime()은 시간을 milliseconds로 리턴한다. | // getTime()은 시간을 milliseconds로 리턴한다. | ||
- | TimeUnit.DAYS.convert(date1.getTime() - date2.getTime(), | + | long diffMillis = date1.getTime() - date2.getTime(); |
+ | |||
+ | TimeUnit.DAYS.convert(diffMillis, TimeUnit.MILLISECONDS); | ||
</ | </ | ||
===== 참고 ===== | ===== 참고 ===== | ||
* [[https:// | * [[https:// | ||