Now

Struct Now 

Source
pub struct Now;
Expand description

当前时间

Implementations§

Source§

impl Now

Source

pub fn utc() -> NaiveDateTime

以UTC形式显示当前时间

Source

pub fn local(zone: ZoneType) -> NaiveDateTime

以当前时区显示当前时间

§参数
  • n 所属时间
  • zone 时区属性,东部时区/西部时区
Source

pub fn timestamp() -> i64

以时间戳的形式表示当前时间

Source

pub fn timestamp_nanos() -> i64

以纳秒为单位的时间戳表示当前时间

Source

pub fn timestamp_micros() -> i64

以微秒为单位的时间戳表示当前时间

Source

pub fn timestamp_millis() -> i64

以毫秒为单位的时间戳表示当前时间

Source

pub fn timestamp_local(zone_type: ZoneType) -> i64

以时间戳的形式表示当地当前时间

Source

pub fn timestamp_local_nanos(zone_type: ZoneType) -> i64

以纳秒为单位时间戳的形式表示当地当前时间

Source

pub fn timestamp_local_milli(zone_type: ZoneType) -> i64

以毫秒为单位时间戳的形式表示当地当前时间

Source

pub fn timestamp_local_micro(zone_type: ZoneType) -> i64

以微秒为单位时间戳的形式表示当地当前时间

Auto Trait Implementations§

§

impl Freeze for Now

§

impl RefUnwindSafe for Now

§

impl Send for Now

§

impl Sync for Now

§

impl Unpin for Now

§

impl UnwindSafe for Now

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.