pub struct DateTime {
pub year: usize,
pub month: usize,
pub day: usize,
pub hour: usize,
pub minute: usize,
pub second: usize,
pub millisecond: usize,
pub day_of_year: usize,
pub weekday: usize,
pub timestamp: i64,
pub offset: i16,
}Fields§
§year: usize[0, +oo)
month: usize[1, 12]
day: usize[1, 31]
hour: usize[0, 23]
minute: usize[0, 59]
second: usize[0, 59]
millisecond: usize[0, 999]
day_of_year: usize[1, 365]
weekday: usize[1, 7]
timestamp: i64时间戳, 单位:毫秒.
offset: i16时间偏移, 比如用+0800表示东八区的时间偏移, 即+08:00.
Implementations§
Trait Implementations§
Source§impl From<(usize, usize, usize, usize, usize, usize, usize, Option<i16>)> for DateTime
impl From<(usize, usize, usize, usize, usize, usize, usize, Option<i16>)> for DateTime
Source§fn from(
value: (usize, usize, usize, usize, usize, usize, usize, Option<i16>),
) -> Self
fn from( value: (usize, usize, usize, usize, usize, usize, usize, Option<i16>), ) -> Self
从设置好的时间, 转成DateTime.
- @param value (year, month, day, hour, minute, second, millisecond, offset)
- @param value$0 年.
- @param value$1 月.
- @param value$2 日.
- @param value$3 时.
- @param value$4 分.
- @param value$5 秒.
- @param value$6 毫秒.
- @param value$7 时间偏移, 默认是系统设置的时区所对应的偏移.
§Panics
如果参数不符合特定的数值范围就会panic.
例如, ’时’的范围是0~23, 如果对应的入参是24, 就会panic.
例如, 某一年的二月份, 只有28天, 但是参数’日’的入参是29, 就会panic.
impl StructuralPartialEq for DateTime
Auto Trait Implementations§
impl Freeze for DateTime
impl RefUnwindSafe for DateTime
impl Send for DateTime
impl Sync for DateTime
impl Unpin for DateTime
impl UnwindSafe for DateTime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more