test_class.file: dddlib-utils/src/test/java/org/dayatang/utils/DateUtilsTest.java
test_class.identifier: DateUtilsTest
test_case.body: @Test
  	public void getMonthDiff() {
  		assertEquals(0, DateUtils.getMonthDiff(parseDate("1968-4-16"), parseDate("1968-4-30")));
  		assertEquals(0, DateUtils.getMonthDiff(parseDate("1968-4-16"), parseDate("1968-5-15")));
  		assertEquals(1, DateUtils.getMonthDiff(parseDate("1968-4-16"), parseDate("1968-5-16")));
  		assertEquals(1, DateUtils.getMonthDiff(parseDate("1968-4-16"), parseDate("1968-5-17")));
  		assertEquals(2, DateUtils.getMonthDiff(parseDate("1968-4-16"), parseDate("1968-6-16")));
  		
  		assertEquals(24, DateUtils.getMonthDiff(parseDate("1968-4-16"), parseDate("1970-4-30")));
  		assertEquals(24, DateUtils.getMonthDiff(parseDate("1968-4-16"), parseDate("1970-5-15")));
  		assertEquals(25, DateUtils.getMonthDiff(parseDate("1968-4-16"), parseDate("1970-5-16")));
  		assertEquals(25, DateUtils.getMonthDiff(parseDate("1968-4-16"), parseDate("1970-5-17")));
  		assertEquals(26, DateUtils.getMonthDiff(parseDate("1968-4-16"), parseDate("1970-6-16")));
  	}
test_case.class_method_signature: DateUtilsTest.getMonthDiff()
test_case.full_signature: @Test public void getMonthDiff()
test_case.identifier: getMonthDiff
test_case.invocations: assertEquals getMonthDiff parseDate parseDate assertEquals getMonthDiff parseDate parseDate assertEquals getMonthDiff parseDate parseDate assertEquals getMonthDiff parseDate parseDate assertEquals getMonthDiff parseDate parseDate assertEquals getMonthDiff parseDate parseDate assertEquals getMonthDiff parseDate parseDate assertEquals getMonthDiff parseDate parseDate assertEquals getMonthDiff parseDate parseDate assertEquals getMonthDiff parseDate parseDate
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getMonthDiff()
focal_class.declarator: MIN_DATE = date(1000, 1, 1)
focal_class.modifier: public static final
focal_class.original_string: public static final Date MIN_DATE = date(1000, 1, 1);
focal_class.type: Date
focal_class.var_name: MIN_DATE
focal_class.declarator: MAX_DATE = date(8888, 1, 1)
focal_class.modifier: public static final
focal_class.original_string: public static final Date MAX_DATE = date(8888, 1, 1);
focal_class.type: Date
focal_class.var_name: MAX_DATE
focal_class.declarator: MILLIS_IN_A_SECOND = 1000
focal_class.modifier: private static final
focal_class.original_string: private static final long MILLIS_IN_A_SECOND = 1000;
focal_class.type: long
focal_class.var_name: MILLIS_IN_A_SECOND
focal_class.declarator: SECONDS_IN_A_MINUTE = 60
focal_class.modifier: private static final
focal_class.original_string: private static final long SECONDS_IN_A_MINUTE = 60;
focal_class.type: long
focal_class.var_name: SECONDS_IN_A_MINUTE
focal_class.declarator: MINUTES_IN_AN_HOUR = 60
focal_class.modifier: private static final
focal_class.original_string: private static final long MINUTES_IN_AN_HOUR = 60;
focal_class.type: long
focal_class.var_name: MINUTES_IN_AN_HOUR
focal_class.declarator: HOURS_IN_A_DAY = 24
focal_class.modifier: private static final
focal_class.original_string: private static final long HOURS_IN_A_DAY = 24;
focal_class.type: long
focal_class.var_name: HOURS_IN_A_DAY
focal_class.declarator: DAYS_IN_A_WEEK = 7
focal_class.modifier: private static final
focal_class.original_string: private static final int DAYS_IN_A_WEEK = 7;
focal_class.type: int
focal_class.var_name: DAYS_IN_A_WEEK
focal_class.declarator: MONTHS_IN_A_YEAR = 12
focal_class.modifier: private static final
focal_class.original_string: private static final int MONTHS_IN_A_YEAR = 12;
focal_class.type: int
focal_class.var_name: MONTHS_IN_A_YEAR
focal_class.file: dddlib-utils/src/main/java/org/dayatang/utils/DateUtils.java
focal_class.identifier: DateUtils
focal_class.class_method_signature: DateUtils.DateUtils()
focal_class.full_signature: private  DateUtils()
focal_class.identifier: DateUtils
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  DateUtils()
focal_class.class_method_signature: DateUtils.date(int year, int month, int day)
focal_class.full_signature: public static Date date(int year, int month, int day)
focal_class.identifier: date
focal_class.modifiers: public static
focal_class.parameters: (int year, int month, int day)
focal_class.return: Date
focal_class.signature: Date date(int year, int month, int day)
focal_class.class_method_signature: DateUtils.date(int year, int month, int day,
              int hour, int minute, int second)
focal_class.full_signature: public static Date date(int year, int month, int day,
              int hour, int minute, int second)
focal_class.identifier: date
focal_class.modifiers: public static
focal_class.parameters: (int year, int month, int day,
              int hour, int minute, int second)
focal_class.return: Date
focal_class.signature: Date date(int year, int month, int day,
              int hour, int minute, int second)
focal_class.class_method_signature: DateUtils.getYearDiff(Date date1, Date date2)
focal_class.full_signature: public static int getYearDiff(Date date1, Date date2)
focal_class.identifier: getYearDiff
focal_class.modifiers: public static
focal_class.parameters: (Date date1, Date date2)
focal_class.return: int
focal_class.signature: int getYearDiff(Date date1, Date date2)
focal_class.class_method_signature: DateUtils.getMonthDiff(Date date1, Date date2)
focal_class.full_signature: public static int getMonthDiff(Date date1, Date date2)
focal_class.identifier: getMonthDiff
focal_class.modifiers: public static
focal_class.parameters: (Date date1, Date date2)
focal_class.return: int
focal_class.signature: int getMonthDiff(Date date1, Date date2)
focal_class.class_method_signature: DateUtils.getDayDiff(Date date1, Date date2)
focal_class.full_signature: public static int getDayDiff(Date date1, Date date2)
focal_class.identifier: getDayDiff
focal_class.modifiers: public static
focal_class.parameters: (Date date1, Date date2)
focal_class.return: int
focal_class.signature: int getDayDiff(Date date1, Date date2)
focal_class.class_method_signature: DateUtils.getMinuteDiffByTime(Date time1, Date time2)
focal_class.full_signature: public static int getMinuteDiffByTime(Date time1, Date time2)
focal_class.identifier: getMinuteDiffByTime
focal_class.modifiers: public static
focal_class.parameters: (Date time1, Date time2)
focal_class.return: int
focal_class.signature: int getMinuteDiffByTime(Date time1, Date time2)
focal_class.class_method_signature: DateUtils.getPrevDay(Date date)
focal_class.full_signature: public static Date getPrevDay(Date date)
focal_class.identifier: getPrevDay
focal_class.modifiers: public static
focal_class.parameters: (Date date)
focal_class.return: Date
focal_class.signature: Date getPrevDay(Date date)
focal_class.class_method_signature: DateUtils.getNextDay(Date date)
focal_class.full_signature: public static Date getNextDay(Date date)
focal_class.identifier: getNextDay
focal_class.modifiers: public static
focal_class.parameters: (Date date)
focal_class.return: Date
focal_class.signature: Date getNextDay(Date date)
focal_class.class_method_signature: DateUtils.isDateAfter(Date date1, Date date2)
focal_class.full_signature: public static boolean isDateAfter(Date date1, Date date2)
focal_class.identifier: isDateAfter
focal_class.modifiers: public static
focal_class.parameters: (Date date1, Date date2)
focal_class.return: boolean
focal_class.signature: boolean isDateAfter(Date date1, Date date2)
focal_class.class_method_signature: DateUtils.isDateBefore(Date date1, Date date2)
focal_class.full_signature: public static boolean isDateBefore(Date date1, Date date2)
focal_class.identifier: isDateBefore
focal_class.modifiers: public static
focal_class.parameters: (Date date1, Date date2)
focal_class.return: boolean
focal_class.signature: boolean isDateBefore(Date date1, Date date2)
focal_class.class_method_signature: DateUtils.isTimeAfter(Date time1, Date time2)
focal_class.full_signature: public static boolean isTimeAfter(Date time1, Date time2)
focal_class.identifier: isTimeAfter
focal_class.modifiers: public static
focal_class.parameters: (Date time1, Date time2)
focal_class.return: boolean
focal_class.signature: boolean isTimeAfter(Date time1, Date time2)
focal_class.class_method_signature: DateUtils.isTimeBefore(Date time1, Date time2)
focal_class.full_signature: public static boolean isTimeBefore(Date time1, Date time2)
focal_class.identifier: isTimeBefore
focal_class.modifiers: public static
focal_class.parameters: (Date time1, Date time2)
focal_class.return: boolean
focal_class.signature: boolean isTimeBefore(Date time1, Date time2)
focal_class.class_method_signature: DateUtils.isSameDay(Date date1, Date date2)
focal_class.full_signature: public static boolean isSameDay(Date date1, Date date2)
focal_class.identifier: isSameDay
focal_class.modifiers: public static
focal_class.parameters: (Date date1, Date date2)
focal_class.return: boolean
focal_class.signature: boolean isSameDay(Date date1, Date date2)
focal_class.class_method_signature: DateUtils.isSameDay(Calendar date1, Calendar date2)
focal_class.full_signature: public static boolean isSameDay(Calendar date1, Calendar date2)
focal_class.identifier: isSameDay
focal_class.modifiers: public static
focal_class.parameters: (Calendar date1, Calendar date2)
focal_class.return: boolean
focal_class.signature: boolean isSameDay(Calendar date1, Calendar date2)
focal_class.class_method_signature: DateUtils.parseDate(String dateString)
focal_class.full_signature: public static Date parseDate(String dateString)
focal_class.identifier: parseDate
focal_class.modifiers: public static
focal_class.parameters: (String dateString)
focal_class.return: Date
focal_class.signature: Date parseDate(String dateString)
focal_class.class_method_signature: DateUtils.parseTime(String timeString)
focal_class.full_signature: public static Date parseTime(String timeString)
focal_class.identifier: parseTime
focal_class.modifiers: public static
focal_class.parameters: (String timeString)
focal_class.return: Date
focal_class.signature: Date parseTime(String timeString)
focal_class.class_method_signature: DateUtils.parseDateTime(String timeString)
focal_class.full_signature: public static Date parseDateTime(String timeString)
focal_class.identifier: parseDateTime
focal_class.modifiers: public static
focal_class.parameters: (String timeString)
focal_class.return: Date
focal_class.signature: Date parseDateTime(String timeString)
focal_class.class_method_signature: DateUtils.getWeekDaysBetween(Date fromDate, Date toDate,
              int dayOfWeek)
focal_class.full_signature: public static int getWeekDaysBetween(Date fromDate, Date toDate,
              int dayOfWeek)
focal_class.identifier: getWeekDaysBetween
focal_class.modifiers: public static
focal_class.parameters: (Date fromDate, Date toDate,
              int dayOfWeek)
focal_class.return: int
focal_class.signature: int getWeekDaysBetween(Date fromDate, Date toDate,
              int dayOfWeek)
focal_class.class_method_signature: DateUtils.getFirstWeekdayBetween(Date fromDate, Date toDate,
              int dayOfWeek)
focal_class.full_signature: public static Date getFirstWeekdayBetween(Date fromDate, Date toDate,
              int dayOfWeek)
focal_class.identifier: getFirstWeekdayBetween
focal_class.modifiers: public static
focal_class.parameters: (Date fromDate, Date toDate,
              int dayOfWeek)
focal_class.return: Date
focal_class.signature: Date getFirstWeekdayBetween(Date fromDate, Date toDate,
              int dayOfWeek)
focal_class.class_method_signature: DateUtils.getDaysInYear(int year)
focal_class.full_signature: public static int getDaysInYear(int year)
focal_class.identifier: getDaysInYear
focal_class.modifiers: public static
focal_class.parameters: (int year)
focal_class.return: int
focal_class.signature: int getDaysInYear(int year)
focal_class.class_method_signature: DateUtils.getDaysInMonth(int year, int month)
focal_class.full_signature: public static int getDaysInMonth(int year, int month)
focal_class.identifier: getDaysInMonth
focal_class.modifiers: public static
focal_class.parameters: (int year, int month)
focal_class.return: int
focal_class.signature: int getDaysInMonth(int year, int month)
focal_class.class_method_signature: DateUtils.getYear(Date date)
focal_class.full_signature: public static int getYear(Date date)
focal_class.identifier: getYear
focal_class.modifiers: public static
focal_class.parameters: (Date date)
focal_class.return: int
focal_class.signature: int getYear(Date date)
focal_class.class_method_signature: DateUtils.getMonth(Date date)
focal_class.full_signature: public static int getMonth(Date date)
focal_class.identifier: getMonth
focal_class.modifiers: public static
focal_class.parameters: (Date date)
focal_class.return: int
focal_class.signature: int getMonth(Date date)
focal_class.class_method_signature: DateUtils.getDayOfYear(Date date)
focal_class.full_signature: public static int getDayOfYear(Date date)
focal_class.identifier: getDayOfYear
focal_class.modifiers: public static
focal_class.parameters: (Date date)
focal_class.return: int
focal_class.signature: int getDayOfYear(Date date)
focal_class.class_method_signature: DateUtils.getDayOfMonth(Date date)
focal_class.full_signature: public static int getDayOfMonth(Date date)
focal_class.identifier: getDayOfMonth
focal_class.modifiers: public static
focal_class.parameters: (Date date)
focal_class.return: int
focal_class.signature: int getDayOfMonth(Date date)
focal_class.class_method_signature: DateUtils.getDayOfWeek(Date date)
focal_class.full_signature: public static int getDayOfWeek(Date date)
focal_class.identifier: getDayOfWeek
focal_class.modifiers: public static
focal_class.parameters: (Date date)
focal_class.return: int
focal_class.signature: int getDayOfWeek(Date date)
focal_class.class_method_signature: DateUtils.getFieldValue(Date date, int field)
focal_class.full_signature: private static int getFieldValue(Date date, int field)
focal_class.identifier: getFieldValue
focal_class.modifiers: private static
focal_class.parameters: (Date date, int field)
focal_class.return: int
focal_class.signature: int getFieldValue(Date date, int field)
focal_class.class_method_signature: DateUtils.dateAfter(Date origDate, int amount, int timeUnit)
focal_class.full_signature: public static final Date dateAfter(Date origDate, int amount, int timeUnit)
focal_class.identifier: dateAfter
focal_class.modifiers: public static final
focal_class.parameters: (Date origDate, int amount, int timeUnit)
focal_class.return: Date
focal_class.signature: Date dateAfter(Date origDate, int amount, int timeUnit)
focal_class.class_method_signature: DateUtils.dateBefore(Date origDate, int amount, int timeUnit)
focal_class.full_signature: public static final Date dateBefore(Date origDate, int amount, int timeUnit)
focal_class.identifier: dateBefore
focal_class.modifiers: public static final
focal_class.parameters: (Date origDate, int amount, int timeUnit)
focal_class.return: Date
focal_class.signature: Date dateBefore(Date origDate, int amount, int timeUnit)
focal_method.body: public static int getMonthDiff(Date date1, Date date2) {
          if (date1 == null || date2 == null) {
              throw new InvalidParameterException(
                      "date1 and date2 cannot be null!");
          }
          if (date1.after(date2)) {
              throw new InvalidParameterException("date1 cannot be after date2!");
          }
  
          Calendar calendar = Calendar.getInstance();
          calendar.setTime(date1);
          int year1 = calendar.get(Calendar.YEAR);
          int month1 = calendar.get(Calendar.MONTH);
          int day1 = calendar.get(Calendar.DATE);
  
          calendar.setTime(date2);
          int year2 = calendar.get(Calendar.YEAR);
          int month2 = calendar.get(Calendar.MONTH);
          int day2 = calendar.get(Calendar.DATE);
  
          int months = 0;
          if (day2 >= day1) {
              months = month2 - month1;
          } else {
              months = month2 - month1 - 1;
          }
          return (year2 - year1) * MONTHS_IN_A_YEAR + months;
      }
focal_method.class_method_signature: DateUtils.getMonthDiff(Date date1, Date date2)
focal_method.full_signature: public static int getMonthDiff(Date date1, Date date2)
focal_method.identifier: getMonthDiff
focal_method.invocations: after getInstance setTime get get get setTime get get get
focal_method.modifiers: public static
focal_method.parameters: (Date date1, Date date2)
focal_method.return: int
focal_method.signature: int getMonthDiff(Date date1, Date date2)