Trait strftime::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§