程序包 dev.utils.common

类 CalendarUtils

    • 字段详细资料

      • MIN_LUNAR_YEAR

        public static final int MIN_LUNAR_YEAR
        另请参阅:
        常量字段值
      • MIN_SOLAR_YEAR

        public static final int MIN_SOLAR_YEAR
        另请参阅:
        常量字段值
    • 方法详细资料

      • isSupportLunar

        public static boolean isSupportLunar​(int year)
        是否支持农历年份计算
        参数:
        year - 年份
        返回:
        true yes, false no
      • isSupportSolar

        public static boolean isSupportSolar​(int year)
        是否支持公历年份计算
        参数:
        year - 年份
        返回:
        true yes, false no
      • solarToLunar

        public static int[] solarToLunar​(int year,
                                         int month,
                                         int day)
        公历转农历
        参数:
        year - 公历年
        month - 公历月
        day - 公历日
        返回:
        [0] 农历年 [1] 农历月 [2] 农历日 [3] 是否闰月 0 false、1 true
      • lunarToSolar

        public static int[] lunarToSolar​(int lunarYear,
                                         int lunarMonth,
                                         int lunarDay,
                                         boolean isLeap)
        农历转公历
        参数:
        lunarYear - 农历年
        lunarMonth - 农历月
        lunarDay - 农历日
        isLeap - 是否闰月
        返回:
        [0] 公历年 [1] 公历月 [2] 公历日
      • getLunarYearDays

        public static int getLunarYearDays​(int year)
        获取农历年份总天数
        参数:
        year - 农历年
        返回:
        农历年份总天数
      • getLunarLeapDays

        public static int getLunarLeapDays​(int year)
        获取农历年份闰月天数
        参数:
        year - 农历年
        返回:
        农历年份闰月天数
      • getLunarLeapMonth

        public static int getLunarLeapMonth​(int year)
        获取农历年份哪个月是闰月
             返回 1 - 12 无闰月返回 0
         
        参数:
        year - 农历年
        返回:
        农历年份哪个月是闰月
      • getLunarMonthDays

        public static int getLunarMonthDays​(int year,
                                            int month)
        获取农历年份与月份总天数
        参数:
        year - 农历年
        month - 农历月
        返回:
        农历年份与月份总天数
      • getLunarGanZhi

        public static java.lang.String getLunarGanZhi​(int year)
        获取干支历
        参数:
        year - 年份
        返回:
        干支历
      • getLunarMonthChinese

        public static java.lang.String getLunarMonthChinese​(int month,
                                                            boolean isLeap)
        获取农历中文月份
        参数:
        month - 农历月
        isLeap - 是否闰月
        返回:
        农历中文月份
      • getLunarDayChinese

        public static java.lang.String getLunarDayChinese​(int day)
        获取农历中文天数
        参数:
        day - 天数
        返回:
        农历中文天数
      • getSolarTermsIndex

        public static int getSolarTermsIndex​(int month,
                                             int day)
        获取二十四节气 ( 公历 ) 索引
        参数:
        month - 公历月
        day - 公历天
        返回:
        二十四节气 ( 公历 ) 索引
      • getSolarTerms

        public static java.lang.String getSolarTerms​(int month,
                                                     int day)
        获取二十四节气 ( 公历 )
        参数:
        month - 公历月
        day - 公历天
        返回:
        二十四节气 ( 公历 )
      • getSolarTermsDate

        public static java.lang.String getSolarTermsDate​(int month,
                                                         int day)
        获取二十四节气 ( 公历 ) 时间
        参数:
        month - 公历月
        day - 公历天
        返回:
        二十四节气 ( 公历 ) 时间
      • isFestival

        public static boolean isFestival​(CalendarUtils.Festival festival,
                                         int year,
                                         int month,
                                         int day)
        校验是否相同节日
        参数:
        festival - 节日信息
        year - 年份
        month - 月份
        day - 天数
        返回:
        true yes, false no
      • isFestival

        public static boolean isFestival​(CalendarUtils.Festival festival,
                                         int year,
                                         int month,
                                         int day,
                                         CalendarUtils.FestivalHook festivalHook)
        校验是否相同节日
        参数:
        festival - 节日信息
        year - 年份
        month - 月份
        day - 天数
        festivalHook - 节日 Hook 接口
        返回:
        true yes, false no
      • getSolarFestival

        public static CalendarUtils.Festival getSolarFestival​(int year,
                                                              int month,
                                                              int day)
        获取公历符合条件的节日信息
        参数:
        year - 年份
        month - 月份
        day - 天数
        返回:
        CalendarUtils.Festival
      • getLunarFestival

        public static CalendarUtils.Festival getLunarFestival​(int year,
                                                              int month,
                                                              int day)
        获取农历符合条件的节日信息
        参数:
        year - 农历年
        month - 农历月
        day - 农历日
        返回:
        CalendarUtils.Festival