pub struct Timestamp(/* private fields */);Expand description
seconds since UNIX epoch
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn utc(&self) -> i64
pub fn utc(&self) -> i64
use cell value as UTC datatime and get timestamp
Examples found in repository?
examples/read_datatime.rs (line 17)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let mut book = XlsxBook::new("xlsx/test.xlsx", true)?;
6 for shname in book.get_visible_sheets().clone() {
7 // left_ncol should not be 0
8 // the tail empty cells will be ignored, if you want the length of cells in each row is fixed, you can set right_ncol to a number not MAX_COL_NUM
9 let mut sheet = book.get_sheet_by_name(&shname, 100, 3, 1, MAX_COL_NUM, false)?;
10
11 if let Some((_, rows_data)) = sheet.get_remaining_cells()? {
12 let row = &rows_data[0];
13 let val_dt: NaiveDate = row[0].get()?.unwrap();
14 let val_tm: NaiveTime = row[0].get()?.unwrap();
15 let val_dttm: NaiveDateTime = row[0].get()?.unwrap();
16 let val_stamp: Timestamp = row[0].get()?.unwrap(); // since v0.1.4
17 println!("date:{}\ntime:{}\ndatetime:{}\ntimestamp:{}", val_dt, val_tm, val_dttm, val_stamp.utc());
18 };
19 }
20 Ok(())
21}Trait Implementations§
Source§impl FromCellValue for Timestamp
impl FromCellValue for Timestamp
Source§impl IntoCellValue for Timestamp
impl IntoCellValue for Timestamp
fn try_into_cval(self) -> Result<CellValue<'static>>
Auto Trait Implementations§
impl Freeze for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnwindSafe for Timestamp
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