[][src]Struct pgdatetime::Timestamp

#[repr(transparent)]pub struct Timestamp(_);

Timestamp represents absolute time.

Implementations

impl Timestamp[src]

pub fn try_from_ymd_hms(
    year: i32,
    month: i32,
    day: i32,
    hour: i32,
    minute: i32,
    second: f64
) -> Result<Self, DateTimeError>
[src]

Construct Timestamp from year, month, day, hour, minute, second. Second can indicate millisecond and microsecond.

pub fn try_from_str(
    s: &str,
    type_mod: i32,
    date_order: DateOrder
) -> Result<Timestamp, DateTimeError>
[src]

Parses Timestamp string. type_mode should be -1, or 1~6, else will be error.

pub fn format(
    self,
    date_style: DateStyle,
    date_order: DateOrder
) -> Result<String, DateTimeError>
[src]

Converts Timestamp to string.

pub fn add_interval(self, span: Interval) -> Result<Self, DateTimeError>[src]

Timestamp add Interval. Note that interval has provisions for qualitative year/month and day units, so try to do the right thing with them. To add a month, increment the month, and use the same day of month. Then, if the next month has fewer days, set the day of month to the last day of month. To add a day, increment the mday, and use the same time of day. Lastly, add in the "quantitative time".

pub fn add_time(self, time: Time) -> Result<Timestamp, DateTimeError>[src]

Timestamp adds Time.

pub fn sub_interval(self, span: Interval) -> Result<Timestamp, DateTimeError>[src]

Timestamp subtracts Interval.

pub fn sub_date(self, date: Date) -> Result<Interval, DateTimeError>[src]

Timestamp subtracts Date.

pub fn sub_time(self, time: Time) -> Result<Timestamp, DateTimeError>[src]

Timestamp subtracts Time.

pub fn sub_timestamp(
    self,
    timestamp: Timestamp
) -> Result<Interval, DateTimeError>
[src]

Timestamp subtracts Timestamp.

pub fn age(self, timestamp: Timestamp) -> Result<Interval, DateTimeError>[src]

Calculates time difference while retaining year/month fields. Note that this does not result in an accurate absolute time span since year and month are out of context once the arithmetic is done.

Trait Implementations

impl Clone for Timestamp[src]

impl Copy for Timestamp[src]

impl DateTime for Timestamp[src]

fn date_part(
    &self,
    ty: FieldType,
    unit: DateUnit
) -> Result<Option<f64>, DateTimeError>
[src]

Extracts specified field from Timestamp.

fn is_finite(&self) -> bool[src]

Checks whether Timestamp is finite.

fn truncate(&self, ty: FieldType, unit: DateUnit) -> Result<Self, DateTimeError>[src]

Truncates Timestamp to specified units.

impl Debug for Timestamp[src]

impl Eq for Timestamp[src]

impl From<Timestamp> for i64[src]

Converts timestamp to i64 type.

impl From<i64> for Timestamp[src]

Converts i64 to timestamp type.

impl Hash for Timestamp[src]

impl Ord for Timestamp[src]

impl PartialEq<Timestamp> for Timestamp[src]

impl PartialOrd<Timestamp> for Timestamp[src]

impl StructuralEq for Timestamp[src]

impl StructuralPartialEq for Timestamp[src]

impl TryFrom<Date> for Timestamp[src]

Converts Date to Timestamp.

type Error = DateTimeError

The type returned in the event of a conversion error.

impl TryFrom<Timestamp> for Date[src]

Converts timestamp to date.

type Error = DateTimeError

The type returned in the event of a conversion error.

impl TryFrom<Timestamp> for Option<Time>[src]

Converts Timestamp to Time.

type Error = DateTimeError

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.