Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

IsoWeekTrait

Fully qualified path: chrono::isoweek::IsoWeekTrait

pub trait IsoWeekTrait

Trait functions

from_yof

Returns the corresponding IsoWeek from the year and the Of internal value.

Fully qualified path: chrono::isoweek::IsoWeekTrait::from_yof

fn from_yof(year: i32, ordinal: u32, year_flags: YearFlags) -> IsoWeek

year

Returns the year number for this ISO week.

Example

use chrono::{Datelike, NaiveDate, Weekday};

let d = NaiveDate::from_isoywd_opt(2015, 1, Weekday::Mon).unwrap();
assert_eq!(d.iso_week().year(), 2015);

This year number might not match the calendar year number. Continuing the example…

 use chrono::{NaiveDate, Datelike, Weekday};
 let d = NaiveDate::from_isoywd_opt(2015, 1, Weekday::Mon).unwrap();
assert_eq!(d.year(), 2014);
assert_eq!(d, NaiveDate::from_ymd_opt(2014, 12, 29).unwrap());

Fully qualified path: chrono::isoweek::IsoWeekTrait::year

fn year(self: @IsoWeek) -> u32

week

Returns the ISO week number starting from 1.

The return value ranges from 1 to 53. (The last week of year differs by years.)

Example

use chrono::{Datelike, NaiveDate, Weekday};

let d = NaiveDate::from_isoywd_opt(2015, 15, Weekday::Mon).unwrap();
assert_eq!(d.iso_week().week(), 15);

Fully qualified path: chrono::isoweek::IsoWeekTrait::week

fn week(self: @IsoWeek) -> u32

week0

Returns the ISO week number starting from 0.

The return value ranges from 0 to 52. (The last week of year differs by years.)

Example

use chrono::{Datelike, NaiveDate, Weekday};

let d = NaiveDate::from_isoywd_opt(2015, 15, Weekday::Mon).unwrap();
assert_eq!(d.iso_week().week0(), 14);

Fully qualified path: chrono::isoweek::IsoWeekTrait::week0

fn week0(self: @IsoWeek) -> u32