[−][src]Struct zip::DateTime
A DateTime field to be used for storing timestamps in a zip file
This structure does bounds checking to ensure the date is able to be stored in a zip file.
When constructed manually from a date and time, it will also check if the input is sensible (e.g. months are from [1, 12]), but when read from a zip some parts may be out of their normal bounds (e.g. month 0, or hour 31).
Methods
impl DateTime
[src]
pub fn from_msdos(datepart: u16, timepart: u16) -> DateTime
[src]
Converts an msdos (u16, u16) pair to a DateTime object
pub fn from_date_and_time(
year: u16,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: u8
) -> Result<DateTime, ()>
[src]
year: u16,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: u8
) -> Result<DateTime, ()>
Constructs a DateTime from a specific date and time
The bounds are:
- year: [1980, 2107]
- month: [1, 12]
- day: [1, 31]
- hour: [0, 23]
- minute: [0, 59]
- second: [0, 60]
pub fn from_time(tm: Tm) -> Result<DateTime, ()>
[src]
Converts a ::time::Tm object to a DateTime
Returns Err
when this object is out of bounds
pub fn timepart(&self) -> u16
[src]
Gets the time portion of this datetime in the msdos representation
pub fn datepart(&self) -> u16
[src]
Gets the date portion of this datetime in the msdos representation
pub fn to_time(&self) -> Tm
[src]
Converts the datetime to a Tm structure
The fields tm_wday
, tm_yday
, tm_utcoff
and tm_nsec
are set to their defaults.
pub fn year(&self) -> u16
[src]
Get the year. There is no epoch, i.e. 2018 will be returned as 2018.
pub fn month(&self) -> u8
[src]
Get the month, where 1 = january and 12 = december
pub fn day(&self) -> u8
[src]
Get the day
pub fn hour(&self) -> u8
[src]
Get the hour
pub fn minute(&self) -> u8
[src]
Get the minute
pub fn second(&self) -> u8
[src]
Get the second
Trait Implementations
impl Clone for DateTime
[src]
impl Copy for DateTime
[src]
impl Debug for DateTime
[src]
impl Default for DateTime
[src]
Auto Trait Implementations
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,