pub struct LunisolarDate { /* private fields */ }
Expand description
農曆年月日,必須包含西曆年。
Implementations§
source§impl LunisolarDate
impl LunisolarDate
sourcepub fn from_solar_date(
solar_date: SolarDate
) -> Result<LunisolarDate, LunisolarError>
pub fn from_solar_date(
solar_date: SolarDate
) -> Result<LunisolarDate, LunisolarError>
將西曆年月日轉成農曆年月日(包含西曆年)。
sourcepub fn to_solar_date(&self) -> SolarDate
pub fn to_solar_date(&self) -> SolarDate
轉成西曆年月日。
sourcepub fn from_naive_date(
naive_date: NaiveDate
) -> Result<LunisolarDate, LunisolarError>
pub fn from_naive_date(
naive_date: NaiveDate
) -> Result<LunisolarDate, LunisolarError>
將無時區的 Chrono
年月日實體,轉成農曆年月日(包含西曆年)。
sourcepub fn from_date<Tz: TimeZone>(
date: Date<Tz>
) -> Result<LunisolarDate, LunisolarError>
pub fn from_date<Tz: TimeZone>(
date: Date<Tz>
) -> Result<LunisolarDate, LunisolarError>
將有時區的 Chrono
年月日實體,依UTC時區轉成農曆年月日(包含西曆年)。
sourcepub unsafe fn from_lunisolar_year_lunar_month_day_unsafe(
lunisolar_year: LunisolarYear,
lunar_month: LunarMonth,
lunar_day: LunarDay
) -> LunisolarDate
pub unsafe fn from_lunisolar_year_lunar_month_day_unsafe(
lunisolar_year: LunisolarYear,
lunar_month: LunarMonth,
lunar_day: LunarDay
) -> LunisolarDate
利用農曆西曆年和農曆月日來產生 LunisolarDate
實體。
sourcepub fn from_lunisolar_year_lunar_month_day(
lunisolar_year: LunisolarYear,
lunar_month: LunarMonth,
lunar_day: LunarDay
) -> Result<LunisolarDate, LunisolarError>
pub fn from_lunisolar_year_lunar_month_day(
lunisolar_year: LunisolarYear,
lunar_month: LunarMonth,
lunar_day: LunarDay
) -> Result<LunisolarDate, LunisolarError>
利用農曆西曆年和農曆月日來產生 LunisolarDate
實體。
sourcepub fn from_ymd(
year: u16,
month: u8,
leap: bool,
day: u8
) -> Result<LunisolarDate, LunisolarError>
pub fn from_ymd(
year: u16,
month: u8,
leap: bool,
day: u8
) -> Result<LunisolarDate, LunisolarError>
利用農曆西曆年和農曆月日來產生 LunisolarDate
實體。
sourcepub fn now() -> Result<LunisolarDate, LunisolarError>
pub fn now() -> Result<LunisolarDate, LunisolarError>
以目前的年月日來產生 LunisolarDate
實體。
sourcepub fn from_str<S: AsRef<str>>(s: S) -> Result<LunisolarDate, LunisolarError>
pub fn from_str<S: AsRef<str>>(s: S) -> Result<LunisolarDate, LunisolarError>
用中文農曆西曆年和農曆月日字串來產生 SolarDate
實體。
sourcepub fn to_chinese_string(&self, chinese_variant: ChineseVariant) -> String
pub fn to_chinese_string(&self, chinese_variant: ChineseVariant) -> String
取得 LunisolarDate
實體所代表的中文農曆西曆年和農曆月日字串。
sourcepub fn write_to_chinese_string(
&self,
chinese_variant: ChineseVariant,
s: &mut String
)
pub fn write_to_chinese_string(
&self,
chinese_variant: ChineseVariant,
s: &mut String
)
取得 LunisolarDate
實體所代表的中文農曆西曆年和農曆月日字串。
sourcepub fn get_solar_year(&self) -> SolarYear
pub fn get_solar_year(&self) -> SolarYear
取得西曆年。
sourcepub fn get_lunisolar_year(&self) -> LunisolarYear
pub fn get_lunisolar_year(&self) -> LunisolarYear
取得農曆西曆年。
sourcepub fn get_lunar_year(&self) -> LunarYear
pub fn get_lunar_year(&self) -> LunarYear
取得農曆年。
sourcepub fn get_lunar_month(&self) -> LunarMonth
pub fn get_lunar_month(&self) -> LunarMonth
取得農曆月。
sourcepub fn get_lunar_day(&self) -> LunarDay
pub fn get_lunar_day(&self) -> LunarDay
取得農曆日。
sourcepub fn the_n_day_in_this_year(&self) -> u16
pub fn the_n_day_in_this_year(&self) -> u16
計算此農曆年月日是該農曆年的第幾天。舉例:2013/正月/初五,就是第五天。
sourcepub fn get_ba_zi_weight(&self, earthly_branch: EarthlyBranch) -> f64
pub fn get_ba_zi_weight(&self, earthly_branch: EarthlyBranch) -> f64
搭配出生時間(地支),來計算八字有幾兩重。
- 子:23~1
- 丑:1~3
- 寅:3~5
- 卯:5~7
- 辰:7~9
- 巳:9~11
- 午:11~13
- 未:13~15
- 申:15~17
- 酉:17~19
- 戌:19~21
- 亥:21~23
sourcepub fn get_ba_zi_weight_by_time<T: Timelike>(&self, time: T) -> f64
pub fn get_ba_zi_weight_by_time<T: Timelike>(&self, time: T) -> f64
搭配出生時間,來計算八字有幾兩重。
Trait Implementations§
source§impl Clone for LunisolarDate
impl Clone for LunisolarDate
source§fn clone(&self) -> LunisolarDate
fn clone(&self) -> LunisolarDate
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more