Crate ptime

Crate ptime 

Source
Expand description

Provides functionality for conversion among Persian (Solar Hijri) and Gregorian calendars. A Julian calendar is used as an interface for all conversions. The crate name is ptime and it is compatible with the crate time. This source code is licensed under MIT license that can be found in the LICENSE file.

§Example

extern crate ptime;

fn main() {
    let p_tm = ptime::from_gregorian_date(2016, 2, 21).unwrap();

    assert_eq!(p_tm.tm_year, 1395);
    assert_eq!(p_tm.tm_mon, 0);
    assert_eq!(p_tm.tm_mday, 2);
}

Structs§

Tm
Represents the components of a moment in time in Persian Calendar.

Functions§

at
Creates a new instance of Persian time from the number of seconds since January 1, 1970 in the local timezone
at_utc
Creates a new instance of Persian time from the number of seconds since January 1, 1970 in UTC
empty_tm
Creates an empty ptime::Tm
from_gregorian
Converts Gregorian calendar to Persian calendar
from_gregorian_components
Creates a new instance of Persian time from Gregorian date components
from_gregorian_date
Creates a new instance of Persian time from Gregorian date
from_persian_components
Creates a new instance of Persian time from Persian date components
from_persian_date
Creates a new instance of Persian time from Persian date
now
Creates a new instance of Persian time corresponding to the current time in the local timezone
now_utc
Creates a new instance of Persian time corresponding to the current time in UTC