[−][src]Struct pgdatetime::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]
year: i32,
month: i32,
day: i32,
hour: i32,
minute: i32,
second: f64
) -> Result<Self, DateTimeError>
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]
s: &str,
type_mod: i32,
date_order: DateOrder
) -> Result<Timestamp, DateTimeError>
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]
self,
date_style: DateStyle,
date_order: DateOrder
) -> Result<String, DateTimeError>
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]
self,
timestamp: Timestamp
) -> Result<Interval, DateTimeError>
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]
&self,
ty: FieldType,
unit: DateUnit
) -> Result<Option<f64>, DateTimeError>
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.
fn is_infinite(&self) -> bool
[src]
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Timestamp
[src]
fn cmp(&self, other: &Timestamp) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Timestamp> for Timestamp
[src]
impl PartialOrd<Timestamp> for Timestamp
[src]
fn partial_cmp(&self, other: &Timestamp) -> Option<Ordering>
[src]
fn lt(&self, other: &Timestamp) -> bool
[src]
fn le(&self, other: &Timestamp) -> bool
[src]
fn gt(&self, other: &Timestamp) -> bool
[src]
fn ge(&self, other: &Timestamp) -> bool
[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.
fn try_from(value: Date) -> Result<Self, Self::Error>
[src]
impl TryFrom<Timestamp> for Date
[src]
Converts timestamp
to date
.
type Error = DateTimeError
The type returned in the event of a conversion error.
fn try_from(value: Timestamp) -> Result<Self, Self::Error>
[src]
impl TryFrom<Timestamp> for Option<Time>
[src]
Converts Timestamp
to Time
.
Auto Trait Implementations
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnwindSafe for Timestamp
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,