public class Solar extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Solar.Month
阳历月
|
static class |
Solar.Quarter
阳历季度
|
static class |
Solar.Semester
阳历半年
|
static class |
Solar.Week
阳历周
|
static class |
Solar.Year
阳历年
|
| Modifier and Type | Field and Description |
|---|---|
static Map<String,String> |
FESTIVAL
日期对应的节日
|
static double |
J2000
2000年儒略日数(2000-1-1 12:00:00 UTC)
|
static Map<String,List<String>> |
OTHER_FESTIVAL
日期对应的非正式节日
|
static Map<String,String> |
WEEK_FESTIVAL
几月第几个星期几对应的节日
|
| Constructor and Description |
|---|
Solar()
默认使用当前日期初始化
|
Solar(Calendar calendar)
通过日历初始化
|
Solar(Date date)
通过日期初始化
|
Solar(double julianDay)
通过儒略日初始化
|
Solar(int year,
int month,
int day)
通过年月日初始化
|
Solar(int year,
int month,
int day,
int hour,
int minute,
int second)
通过年月日初始化
|
| Modifier and Type | Method and Description |
|---|---|
String |
build(boolean... args)
构建字符串内容
|
static Solar |
from(Calendar calendar)
通过指定日历获取阳历
|
static Solar |
from(Date date)
通过指定日期获取阳历
|
static Solar |
from(double julianDay)
通过指定儒略日获取阳历
|
static Solar |
from(int year,
int month,
int day)
通过指定年月日获取阳历
|
static Solar |
from(int year,
int month,
int day,
int hour,
int minute,
int second)
通过指定年月日时分获取阳历
|
static List<Solar> |
from(String yearGanZhi,
String monthGanZhi,
String dayGanZhi,
String timeGanZhi)
通过八字获取阳历列表(晚子时日柱按当天,起始年为1900)
|
static List<Solar> |
from(String yearGanZhi,
String monthGanZhi,
String dayGanZhi,
String timeGanZhi,
int sect)
通过八字获取阳历列表(起始年为1900)
|
static List<Solar> |
fromBaZi(String yearGanZhi,
String monthGanZhi,
String dayGanZhi,
String timeGanZhi,
int sect,
int baseYear)
通过八字获取阳历列表(起始年为1900)
|
Calendar |
getCalendar()
获取日历
|
int |
getDay()
获取日期
|
static int |
getDaysOfMonth(int year,
int month)
获取某年某月有多少天
|
List<String> |
getFestivals()
获取节日,有可能一天会有多个节日
|
int |
getHour()
获取小时
|
double |
getJulianDay()
获取儒略日
|
Lunar |
getLunar()
获取农历
|
int |
getMinute()
获取分钟
|
int |
getMonth()
获取月份
|
List<String> |
getOtherFestivals()
获取非正式的节日,有可能一天会有多个节日
|
int |
getSecond()
获取秒钟
|
int |
getWeek()
获取星期,1代表周日
|
String |
getWeekInChinese()
获取星期的中文
|
static int |
getWeeksOfMonth(int year,
int month,
int start)
获取某年某月有多少周
|
int |
getYear()
获取年份
|
String |
getZodiac()
获取星座
|
boolean |
isLeapYear()
是否闰年
|
static boolean |
isLeapYear(int year)
是否闰年
|
Solar |
next(int days)
获取往后推几天的阳历日期,如果要往前推,则天数用负数
|
Solar |
next(int days,
boolean onlyWorkday)
取往后推几天的阳历日期,如果要往前推,则天数用负数
|
public static final double J2000
public Solar()
public Solar(Date date)
date - 日期public Solar(Calendar calendar)
calendar - 日历public Solar(double julianDay)
julianDay - 儒略日public Solar(int year,
int month,
int day,
int hour,
int minute,
int second)
year - 年month - 月,1到12day - 日,1到31hour - 小时,0到23minute - 分钟,0到59second - 秒钟,0到59public Solar(int year,
int month,
int day)
year - 年month - 月,1到12day - 日,1到31public static Solar from(double julianDay)
julianDay - 儒略日public static Solar from(int year, int month, int day)
year - 年month - 月,1到12day - 日,1到31public static Solar from(int year, int month, int day, int hour, int minute, int second)
year - 年month - 月,1到12day - 日,1到31hour - 小时,0到23minute - 分钟,0到59second - 秒钟,0到59public static List<Solar> from(String yearGanZhi, String monthGanZhi, String dayGanZhi, String timeGanZhi)
yearGanZhi - 年柱monthGanZhi - 月柱dayGanZhi - 日柱timeGanZhi - 时柱public static List<Solar> from(String yearGanZhi, String monthGanZhi, String dayGanZhi, String timeGanZhi, int sect)
yearGanZhi - 年柱monthGanZhi - 月柱dayGanZhi - 日柱timeGanZhi - 时柱sect - 流派,2晚子时日柱按当天,1晚子时日柱按明天public static List<Solar> fromBaZi(String yearGanZhi, String monthGanZhi, String dayGanZhi, String timeGanZhi, int sect, int baseYear)
yearGanZhi - 年柱monthGanZhi - 月柱dayGanZhi - 日柱timeGanZhi - 时柱sect - 流派,2晚子时日柱按当天,1晚子时日柱按明天baseYear - 起始年public static boolean isLeapYear(int year)
year - 年public static int getDaysOfMonth(int year,
int month)
year - 年month - 月public static int getWeeksOfMonth(int year,
int month,
int start)
year - 年month - 月start - 星期几作为一周的开始,默认星期日public boolean isLeapYear()
public int getWeek()
public String getWeekInChinese()
public List<String> getOtherFestivals()
public String getZodiac()
public double getJulianDay()
public Solar next(int days, boolean onlyWorkday)
days - 天数onlyWorkday - 是否仅限工作日Solarpublic Lunar getLunar()
public int getYear()
public int getMonth()
public int getDay()
public int getHour()
public int getMinute()
public int getSecond()
public Calendar getCalendar()
public String build(boolean... args)
args - 可选参数-简化输出Copyright © 2021. All rights reserved.