[][src]Struct utc_datetime::UTCDatetime

pub struct UTCDatetime { /* fields omitted */ }

Methods

impl UTCDatetime[src]

pub fn new(
    year: u16,
    month: u8,
    day: u8,
    hour: u8,
    minute: u8,
    second: u8
) -> Result<UTCDatetime, IllegalTimeError>
[src]

Create a new UTCDatetimr structure

pub fn get_timestamp(&self) -> Result<u32, IllegalTimeError>[src]

Returns the number of seconds since January 1, 1970

pub fn day_of_the_week(&self) -> u8[src]

Return today is the day of the week,Monday to Saturday Return 1 to 6,Sunday return 0

pub fn from_string(time_str: &str) -> Result<UTCDatetime, IllegalTimeError>[src]

Convert a string containing time to UTCDatetime.

Time strings must be sorted by year, month, day, hour, minute, and second, and Non-arabic numbers can be used as separators

Parsable string example:"2020-12-31 23:59:59","2020z12z31z23z59z59".

Example

use utc_datetime::UTCDatetime;
let a_utc_datetime=UTCDatetime::from_string("2020-12-31 23:59:59").unwrap();
assert_eq!(a_utc_datetime,UTCDatetime::new(2020,12,31,23,59,59).unwrap());

Trait Implementations

impl Debug for UTCDatetime[src]

impl Display for UTCDatetime[src]

impl PartialEq<UTCDatetime> for UTCDatetime[src]

impl PartialOrd<UTCDatetime> for UTCDatetime[src]

impl StructuralPartialEq for UTCDatetime[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.