이 기사의 예는 주로 다음과 같이 두 날짜의 달의 차이를 계산합니다.
package com.forezp.util; import org.joda.time.dateTime; import org.joda.time.months; import org.joda.time.format.datetimeformat; import org.joda.time.format.datetimeformat;/*** 두 Dates 간의 달 차이를 계산하는 방법? <br> * * * @author 관리자 * */public class demo1 {public static void main (String [] args) {dateTimeFormatter formatter = dateTimeFormat.forPattern ( "yyyy-mm-dd"); dateTime start = formatter.parsEdateTime ( "2017-07-11"); formatter.parsedateTime ( "2017-11-19"); int month = months.monthsbetween (시작, 끝) .getMonths (); System.out.println (Month);}}실행 결과 :
Maven 가져 오기 종속성 :
<pectionency> <groupId> Joda-time </groupid> <artifactid> Joda-time </artifactid> <bersion> 2.9.6 </version> </fectionency>
요약
위는 Java 프로그래밍 구현에 대한이 기사의 전체 내용입니다. 두 날짜의 월 차이 인스턴스 코드를 계산합니다. 모든 사람에게 도움이되기를 바랍니다. 관심있는 친구는이 사이트의 다른 관련 주제를 계속 참조 할 수 있습니다. 단점이 있으면 메시지를 남겨 두십시오. 이 사이트를 지원해 주신 친구들에게 감사드립니다!