pub struct Zemen { /* private fields */ }
Expand description

An Ethiopian Date.

Implementations

Get the year.

let qen: Zemen = Zemen::from_eth_cal(2000, 1, 1).unwrap();
assert_eq!(qen.year(), 2000);

Get the month.


let qen: Zemen = Zemen::from_eth_cal(2000, 1, 1).unwrap();
assert_eq!(qen.month(), Month::Meskerem);

Get the day of the month.

let qen: Zemen = Zemen::from_eth_cal(2000, 1, 30).unwrap();
assert_eq!(qen.day(), 30);

returns the current date in Ethiopian date.


let today: time::Date = time::OffsetDateTime::now_utc().date();
let zare: Zemen = Zemen::today();

assert_eq!(today, zare.to_gre());

Takes a gregorian calendar, converts into Ethiopian calendar and returns a Zemen instance.


let date: Date = Date::from_calendar_date(2000, Month::January, 1).unwrap();
let qen: Zemen = Zemen::from_gre_cal(2000, 1, 1).unwrap();

assert_eq!(date, qen.to_gre());

Builds a new Zemen instance from a borrowed time::Date.


let date: Date = Date::from_calendar_date(2000, Month::January, 1).unwrap();
let qen: Zemen = Zemen::from_gre_date(&date);
assert_eq!(date, qen.to_gre());

Create an Ethiopian date from it’s number representations

let qen = Zemen::from_eth_cal(1992, 4, 22).unwrap();
 
assert_eq!(qen.year(), 1992);
assert_eq!(qen.month(), Month::Tahasass);
assert_eq!(qen.day(), 22);

Convertes the current Ethiopian date into time::Date.

let qen: Zemen = Zemen::from_eth_cal(1992, 4, 22).unwrap();
let date: Date = Date::from_calendar_date(2000, Month::January, 1).unwrap();

assert_eq!(date, qen.to_gre());

Create an Ethiopian date from Julian day number.


assert_eq!(Zemen::from_jdn(2_451_545), Zemen::from_eth_cal(1992, 4, 22));
assert_eq!(Zemen::from_jdn(2_458_485), Zemen::from_eth_cal(2011, 4, 23));
assert_eq!(Zemen::from_jdn(2_458_849), Zemen::from_eth_cal(2012, 4, 21));

Get the Julian day number for the Ethiopian date.


assert_eq!(Zemen::from_eth_cal(1992, 4, 22).unwrap().to_jdn(), 2_451_545);
assert_eq!(Zemen::from_eth_cal(2011, 4, 23).unwrap().to_jdn(), 2_458_485);
assert_eq!(Zemen::from_eth_cal(2012, 4, 21).unwrap().to_jdn(), 2_458_849);

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.