Struct chinese_lunisolar_calendar::SolarDate
source · [−]pub struct SolarDate { /* private fields */ }
Expand description
西曆年月日。
Implementations
sourceimpl 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
實體所代表的中文西曆年月日字串。以零
表示數字0
。
sourcepub fn to_chinese_string_2(self) -> String
pub fn to_chinese_string_2(self) -> String
取得 SolarDate
實體所代表的中文西曆年月日字串。以〇
表示數字0
。
sourcepub fn write_to_chinese_string(self, s: &mut String)
pub fn write_to_chinese_string(self, s: &mut String)
取得 SolarDate
實體所代表的中文西曆年月日字串。以零
表示數字0
。
sourcepub fn write_to_chinese_string_2(self, s: &mut String)
pub fn write_to_chinese_string_2(self, s: &mut String)
取得 SolarDate
實體所代表的中文西曆年月日字串。以〇
表示數字0
。
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,就是第四天。
Trait Implementations
impl Copy for SolarDate
impl Eq for SolarDate
impl StructuralEq for SolarDate
impl StructuralPartialEq for SolarDate
Auto Trait Implementations
impl RefUnwindSafe for SolarDate
impl Send for SolarDate
impl Sync for SolarDate
impl Unpin for SolarDate
impl UnwindSafe for SolarDate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more