strftime

Trait Time

Source
pub trait Time {
Show 13 methods // Required methods fn year(&self) -> i32; fn month(&self) -> u8; fn day(&self) -> u8; fn hour(&self) -> u8; fn minute(&self) -> u8; fn second(&self) -> u8; fn nanoseconds(&self) -> u32; fn day_of_week(&self) -> u8; fn day_of_year(&self) -> u16; fn to_int(&self) -> i64; fn is_utc(&self) -> bool; fn utc_offset(&self) -> i32; fn time_zone(&self) -> &str;
}
Expand description

Common methods needed for formatting time.

This should be implemented for structs representing a time.

All the strftime functions take as input an implementation of this trait.

Required Methods§

Source

fn year(&self) -> i32

Returns the year for time (including the century).

Source

fn month(&self) -> u8

Returns the month of the year in 1..=12 for time.

Source

fn day(&self) -> u8

Returns the day of the month in 1..=31 for time.

Source

fn hour(&self) -> u8

Returns the hour of the day in 0..=23 for time.

Source

fn minute(&self) -> u8

Returns the minute of the hour in 0..=59 for time.

Source

fn second(&self) -> u8

Returns the second of the minute in 0..=60 for time.

Source

fn nanoseconds(&self) -> u32

Returns the number of nanoseconds in 0..=999_999_999 for time.

Source

fn day_of_week(&self) -> u8

Returns an integer representing the day of the week in 0..=6, with Sunday == 0.

Source

fn day_of_year(&self) -> u16

Returns an integer representing the day of the year in 1..=366.

Source

fn to_int(&self) -> i64

Returns the number of seconds as a signed integer since the Epoch.

Source

fn is_utc(&self) -> bool

Returns true if the time zone is UTC.

Source

fn utc_offset(&self) -> i32

Returns the offset in seconds between the timezone of time and UTC.

Source

fn time_zone(&self) -> &str

Returns the name of the time zone as a string.

Implementors§