Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

Timelike

The common set of methods for time component.

Fully qualified path: chrono::traits::Timelike

pub trait Timelike<T>

Trait functions

hour

Returns the hour number from 0 to 23.

Fully qualified path: chrono::traits::Timelike::hour

fn hour(self: @T) -> u32

hour12

Returns the hour number from 1 to 12 with a boolean flag, which is false for AM and true for PM.

Fully qualified path: chrono::traits::Timelike::hour12

fn hour12(self: @T) -> (bool, u32)

minute

Returns the minute number from 0 to 59.

Fully qualified path: chrono::traits::Timelike::minute

fn minute(self: @T) -> u32

second

Returns the second number from 0 to 59.

Fully qualified path: chrono::traits::Timelike::second

fn second(self: @T) -> u32

with_hour

Makes a new value with the hour number changed.

Returns None when the resulting value would be invalid.

Fully qualified path: chrono::traits::Timelike::with_hour

fn with_hour(self: @T, hour: u32) -> Option<T>

with_minute

Makes a new value with the minute number changed.

Returns None when the resulting value would be invalid.

Fully qualified path: chrono::traits::Timelike::with_minute

fn with_minute(self: @T, min: u32) -> Option<T>

with_second

Makes a new value with the second number changed.

Returns None when the resulting value would be invalid. As with the second method, the input range is restricted to 0 through 59.

Fully qualified path: chrono::traits::Timelike::with_second

fn with_second(self: @T, sec: u32) -> Option<T>

num_seconds_from_midnight

Returns the number of non-leap seconds past the last midnight.

Every value in 00:00:00-23:59:59 maps to an integer in 0-86399.

This method is not intended to provide the real number of seconds since midnight on a given day. It does not take things like DST transitions into account.

Fully qualified path: chrono::traits::Timelike::num_seconds_from_midnight

fn num_seconds_from_midnight(self: @T) -> u32