Date

Struct Date 

Source
pub struct Date { /* private fields */ }
Expand description

Represents a date and time value used in PDF documents.

This struct stores time information with millisecond precision, following the PDF specification for date/time representation.

Implementations§

Source§

impl Date

Source

pub fn new( year: i32, month: u8, day: u8, hour: u8, minute: u8, second: u8, time_zero: i8, utm: u8, ) -> Self

Creates a new Date instance with the specified date and time components.

§Arguments
  • year - The year (e.g., 2024)
  • month - The month (1-12)
  • day - The day of the month (1-31)
  • hour - The hour (0-23)
  • minute - The minute (0-59)
  • second - The second (0-59)
  • time_zero - Time zone offset from UTC in hours (-12 to +12)
  • utm - shall be the absolute value of the offset from UT in minutes (00–59)
§Returns

A new Date instance with the calculated Unix timestamp in milliseconds

Source

pub fn get_millisecond(&self) -> u64

Returns the millisecond component of the date and time.

This represents the number of milliseconds elapsed since the Unix epoch (January 1, 1970, 00:00:00 UTC), adjusted for the time zone offset.

§Returns

The millisecond value as a u64.

Source

pub fn get_time_zero(&self) -> i8

Returns the time zone offset from UTC in hours.

This represents the time zone offset that was used when creating this Date instance. The value is in the range of -12 to +12 hours.

§Returns

The time zone offset in hours as an i8.

Trait Implementations§

Source§

impl FromStr for Date

Source§

type Err = PDFError

The associated error which can be returned from parsing.
Source§

fn from_str(text: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more

Auto Trait Implementations§

§

impl Freeze for Date

§

impl RefUnwindSafe for Date

§

impl Send for Date

§

impl Sync for Date

§

impl Unpin for Date

§

impl UnwindSafe for Date

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.