Struct chinese_lunisolar_calendar::SolarDate
source · pub struct SolarDate { /* private fields */ }
Expand description
西曆年月日。
Implementations§
source§impl SolarDate
impl SolarDate
sourcepub fn from_naive_date(
naive_date: NaiveDate
) -> Result<SolarDate, LunisolarError>
pub fn from_naive_date(
naive_date: NaiveDate
) -> Result<SolarDate, LunisolarError>
將無時區的 Chrono
年月日實體轉成 SolarDate
實體。
sourcepub fn from_date<Tz: TimeZone>(
date: Date<Tz>
) -> Result<SolarDate, LunisolarError>
pub fn from_date<Tz: TimeZone>(
date: Date<Tz>
) -> Result<SolarDate, LunisolarError>
將有時區的 Chrono
年月日實體,依UTC時區轉成 SolarDate
實體。
sourcepub fn to_naive_date(&self) -> NaiveDate
pub fn to_naive_date(&self) -> NaiveDate
將 SolarDate
實體轉成無時區的 Chrono
年月日實體。
sourcepub fn to_date_utc(&self) -> Date<Utc>
pub fn to_date_utc(&self) -> Date<Utc>
將 SolarDate
實體轉成UTC時區的 Chrono
年月日實體。
sourcepub fn from_solar_year_month_day<Y: Into<SolarYear>>(
solar_year: Y,
solar_month: SolarMonth,
solar_day: SolarDay
) -> Result<SolarDate, LunisolarError>
pub fn from_solar_year_month_day<Y: Into<SolarYear>>(
solar_year: Y,
solar_month: SolarMonth,
solar_day: SolarDay
) -> Result<SolarDate, LunisolarError>
利用西曆的年月日來產生 SolarDate
實體。
sourcepub fn from_ymd(
year: u16,
month: u8,
day: u8
) -> Result<SolarDate, LunisolarError>
pub fn from_ymd(
year: u16,
month: u8,
day: u8
) -> Result<SolarDate, LunisolarError>
利用西曆的年月日來產生 SolarDate
實體。
sourcepub fn from_lunisolar_date(lunisolar_date: LunisolarDate) -> SolarDate
pub fn from_lunisolar_date(lunisolar_date: LunisolarDate) -> SolarDate
利用農曆年月日來產生 SolarDate
實體。
sourcepub fn to_lunisolar_date(&self) -> Result<LunisolarDate, LunisolarError>
pub fn to_lunisolar_date(&self) -> Result<LunisolarDate, LunisolarError>
轉成農曆年月日。
sourcepub fn now() -> Result<SolarDate, LunisolarError>
pub fn now() -> Result<SolarDate, LunisolarError>
以目前的年月日來產生 SolarDate
實體。
sourcepub fn from_str<S: AsRef<str>>(s: S) -> Result<SolarDate, LunisolarError>
pub fn from_str<S: AsRef<str>>(s: S) -> Result<SolarDate, LunisolarError>
用中文西曆年月日字串來產生 SolarDate
實體。
sourcepub fn to_chinese_string(&self) -> String
pub fn to_chinese_string(&self) -> String
取得 SolarDate
實體所代表的中文西曆年月日字串。
sourcepub fn write_to_chinese_string(&self, s: &mut String)
pub fn write_to_chinese_string(&self, s: &mut String)
取得 SolarDate
實體所代表的中文西曆年月日字串。
sourcepub fn get_solar_year(&self) -> SolarYear
pub fn get_solar_year(&self) -> SolarYear
取得西曆年。
sourcepub fn get_solar_month(&self) -> SolarMonth
pub fn get_solar_month(&self) -> SolarMonth
取得西曆月。
sourcepub fn get_solar_day(&self) -> SolarDay
pub fn get_solar_day(&self) -> SolarDay
取得西曆日。
sourcepub fn the_n_day_in_this_year(&self) -> u16
pub fn the_n_day_in_this_year(&self) -> u16
計算此西曆年月日是該西曆年的第幾天。舉例:2013-01-04,就是第四天。