Package org.aoju.bus.core.date
Class Solar
java.lang.Object
org.aoju.bus.core.date.Solar
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class阳历月static class阳历季度static class阳历半年static class阳历周static class阳历年 -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild(boolean... args) 构建字符串内容static Solarfrom(double julianDay) 通过指定儒略日获取阳历static Solarfrom(int year, int month, int day) 通过指定年月日获取阳历static Solarfrom(int year, int month, int day, int hour, int minute, int second) 通过指定年月日时分获取阳历通过八字获取阳历列表(晚子时日柱按当天,起始年为1900)通过八字获取阳历列表(起始年为1900)static Solar通过指定日历获取阳历static Solar通过指定日期获取阳历fromBaZi(String yearGanZhi, String monthGanZhi, String dayGanZhi, String timeGanZhi, int sect, int baseYear) 通过八字获取阳历列表(起始年为1900)intgetDay()获取日期static intgetDays(int ay, int am, int ad, int by, int bm, int bd) 获取两个日期之间相差的天数(如果日期a比日期b小,天数为正,如果日期a比日期b大,天数为负)static int获取两个日期之间相差的天数(如果日期a比日期b小,天数为正,如果日期a比日期b大,天数为负)static intgetDaysInYear(int year, int month, int day) 获取某天为当年的第几天static intgetDaysOfMonth(int year, int month) 获取某年某月有多少天static intgetDaysOfYear(int year) 获取某年有多少天(平年365天,闰年366天)获取节日,有可能一天会有多个节日intgetHour()获取小时double获取儒略日getLunar()获取农历int获取分钟intgetMonth()获取月份获取非正式的节日,有可能一天会有多个节日int获取秒钟intgetWeek()获取星期,0代表周日获取星期的中文static intgetWeeksOfMonth(int year, int month, int start) 获取某年某月有多少周intgetYear()获取年份获取星座boolean是否在指定日期之后boolean是否在指定日期之前boolean是否闰年static booleanisLeapYear(int year) 是否闰年next(int days) 获取往后推几天的阳历日期,如果要往前推,则天数用负数next(int days, boolean onlyWorkday) 取往后推几天的阳历日期,如果要往前推,则天数用负数nextHour(int hours) 小时推移nextMonth(int months) 月推移nextYear(int years) 年推移int阳历日期相减,获得相差天数intsubtractMinute(Solar solar) 阳历日期相减,获得相差分钟数toYmd()
-
Field Details
-
FESTIVAL
-
WEEK_FESTIVAL
-
OTHER_FESTIVAL
-
J2000
public static final double J20002000年儒略日数(2000-1-1 12:00:00 UTC)- See Also:
-
-
Constructor Details
-
Solar
public Solar()默认使用当前日期初始化 -
Solar
-
Solar
-
Solar
public Solar(double julianDay) 通过儒略日初始化- Parameters:
julianDay- 儒略日
-
Solar
public Solar(int year, int month, int day) 通过年月日初始化- Parameters:
year- 年month- 月,1到12day- 日,1到31
-
Solar
public Solar(int year, int month, int day, int hour, int minute, int second) 通过年月日初始化- Parameters:
year- 年month- 月,1到12day- 日,1到31hour- 小时,0到23minute- 分钟,0到59second- 秒钟,0到59
-
-
Method Details
-
from
-
from
-
from
-
from
通过指定年月日获取阳历- Parameters:
year- 年month- 月,1到12day- 日,1到31- Returns:
- 阳历
-
from
通过指定年月日时分获取阳历- Parameters:
year- 年month- 月,1到12day- 日,1到31hour- 小时,0到23minute- 分钟,0到59second- 秒钟,0到59- Returns:
- 阳历
-
from
-
from
-
fromBaZi
-
isLeapYear
public static boolean isLeapYear(int year) 是否闰年- Parameters:
year- 年- Returns:
- true/false 闰年/非闰年
-
getDaysOfYear
public static int getDaysOfYear(int year) 获取某年有多少天(平年365天,闰年366天)- Parameters:
year- 年- Returns:
- 天数
-
getDaysOfMonth
public static int getDaysOfMonth(int year, int month) 获取某年某月有多少天- Parameters:
year- 年month- 月- Returns:
- 天数
-
getDaysInYear
public static int getDaysInYear(int year, int month, int day) 获取某天为当年的第几天- Parameters:
year- 年month- 月day- 日- Returns:
- 第几天
-
getWeeksOfMonth
public static int getWeeksOfMonth(int year, int month, int start) 获取某年某月有多少周- Parameters:
year- 年month- 月start- 星期几作为一周的开始,默认星期日- Returns:
- 周数
-
getDays
public static int getDays(int ay, int am, int ad, int by, int bm, int bd) 获取两个日期之间相差的天数(如果日期a比日期b小,天数为正,如果日期a比日期b大,天数为负)- Parameters:
ay- 年aam- 月aad- 日aby- 年bbm- 月bbd- 日b- Returns:
- 天数
-
getDays
-
isLeapYear
public boolean isLeapYear()是否闰年- Returns:
- true/false 闰年/非闰年
-
getWeek
public int getWeek()获取星期,0代表周日- Returns:
- 1234567
-
getWeekInChinese
-
getFestivals
-
getOtherFestivals
-
getZodiac
-
getJulianDay
public double getJulianDay()获取儒略日- Returns:
- 儒略日
-
getLunar
-
getYear
public int getYear()获取年份- Returns:
- 如2020
-
getMonth
public int getMonth()获取月份- Returns:
- 1到12
-
getDay
public int getDay()获取日期- Returns:
- 1到31之间的数字
-
getHour
public int getHour()获取小时- Returns:
- 0到23之间的数字
-
getMinute
public int getMinute()获取分钟- Returns:
- 0到59之间的数字
-
getSecond
public int getSecond()获取秒钟- Returns:
- 0到59之间的数字
-
toYmd
-
subtract
-
subtractMinute
-
isAfter
-
isBefore
-
nextYear
-
nextMonth
-
nextHour
-
next
-
next
-
build
-