Struct datetime::YearMonth [] [src]

pub struct YearMonth {
    pub year: Year,
    pub month: Month,
}

A month-year pair.

Fields

Methods

impl YearMonth
[src]

Returns the number of days in this month. This can be definitely known, as the paired year determines whether it’s a leap year, so there’s no chance of being caught out by February.

Examples

use datetime::Year;
use datetime::Month::February;

assert_eq!(Year(2000).month(February).day_count(), 29);
assert_eq!(Year(1900).month(February).day_count(), 28);

Returns an iterator over a continuous span of days in this month, returning LocalDate values.

Examples

use datetime::Year;
use datetime::Month::September;

let ym = Year(1999).month(September);
assert_eq!(ym.days(..).count(), 30);
assert_eq!(ym.days(10 ..).count(), 21);
assert_eq!(ym.days(10 .. 20).count(), 10);
assert_eq!(ym.days(.. 20).count(), 19);

Returns a LocalDate based on the day of this month.

This is just a short-cut for the LocalDate::ymd constructor.

Trait Implementations

impl PartialEq for YearMonth
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Debug for YearMonth
[src]

Formats the value using the given formatter.

impl Copy for YearMonth
[src]

impl Clone for YearMonth
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more