#date-time #utc #string #timestamp #convert

utc-datetime

Return timestamp of UTC datetime,Convert time string to UTC datetime

15 releases

0.1.17 Nov 16, 2021
0.1.16 Nov 15, 2021
0.1.15 Jun 26, 2021
0.1.14 Apr 28, 2020

#457 in Date and time

28 downloads per month

MIT license

10KB
146 lines

The main function

impl UtcDatetime{
    fn new(year:u16,month:u8,day:u8,hour:u8,minute:u8,second:u8)->Result<UTCDatetime, IllegalTimeError>;
    fn timestamp(&self)->Result<u32,IllegalTimeError>;
    fn weekday(&self)->u8;
    fn from_string(time_str:&str)->Result<UTCDatetime, IllegalTimeError>;
}

The UTCDatetime structure derives PartialEq and PartialOrd, you can directly use <,>, ==, <=,>=,!= for comparison.

No runtime deps