pub trait Time {
Show 13 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

Returns the year for time (including the century).

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

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

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

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

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

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

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

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

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

Returns true if the time zone is UTC.

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

Returns the name of the time zone as a string.

Implementors