/// <summary> /// 起运计算 /// </summary> private void computeStart() { JieQi prev = lunar.getPrevJie(); JieQi next = lunar.getNextJie(); Solar current = lunar.getSolar(); Solar start = forward ? current : prev.getSolar(); Solar end = forward ? next.getSolar() : current; int hourDiff = LunarUtil.getTimeZhiIndex(end.toYmdHms().Substring(11, 5)) - LunarUtil.getTimeZhiIndex(start.toYmdHms().Substring(11, 5)); DateTime endCalendar = new DateTime(end.getYear(), end.getMonth(), end.getDay(), 0, 0, 0, 0); DateTime startCalendar = new DateTime(start.getYear(), start.getMonth(), start.getDay(), 0, 0, 0, 0); int dayDiff = endCalendar.Subtract(startCalendar).Days; if (hourDiff < 0) { hourDiff += 12; dayDiff--; } int monthDiff = hourDiff * 10 / 30; int month = dayDiff * 4 + monthDiff; int day = hourDiff * 10 - monthDiff * 30; int year = month / 12; month = month - year * 12; this.startYear = year; this.startMonth = month; this.startDay = day; }