1
0
mirror of synced 2026-10-24 15:36:11 +08:00

add static fromXX methods

This commit is contained in:
6tail
2018-06-24 17:48:32 +08:00
parent 7741dfe979
commit c196e58ec8
7 changed files with 217 additions and 5 deletions

View File

@@ -32,10 +32,10 @@ public class Lunar{
/**
* 通过农历年月日初始化
*
* @param year 年
* @param month 月
* @param day 日
*
* @param year 年(农历)
* @param month 月(农历),1到12
* @param day 日(农历),1到31
*/
public Lunar(int year,int month,int day){
this.year = year;
@@ -92,6 +92,28 @@ public class Lunar{
day = lunarD;
}
/**
* 通过指定日期获取农历
*
* @param date 日期
* @return 农历
*/
public static Lunar fromDate(Date date){
return new Lunar(date);
}
/**
* 通过指定农历年月日获取农历
*
* @param year 年(农历)
* @param month 月(农历),1到12
* @param day 日(农历),1到31
* @return 农历
*/
public static Lunar fromYmd(int year,int month,int day){
return new Lunar(year,month,day);
}
/**
* 获取干
*