pub struct Timestamp { /* private fields */ }
Expand description
Represents a point in time to a specified degree of precision. Unlike chrono
’s NaiveDateTime
and DateTime, a Timestamp
has variable precision ranging from a year to fractional seconds
of an arbitrary unit.
Implementations
sourceimpl Timestamp
impl Timestamp
sourcepub fn from_datetime<D>(datetime: D, precision: Precision) -> Timestamp where
D: Datelike + Timelike + Into<Timestamp>,
pub fn from_datetime<D>(datetime: D, precision: Precision) -> Timestamp where
D: Datelike + Timelike + Into<Timestamp>,
Converts a NaiveDateTime or DateTime
sourcepub fn fractional_seconds_scale(&self) -> Option<i64>
pub fn fractional_seconds_scale(&self) -> Option<i64>
If the precision is Precision::FractionalSeconds, returns a Decimal scale of this Timestamp’s fractional seconds; otherwise, returns None.
For example, a Timestamp with 553 milliseconds would return a Decimal scale of 3.
sourcepub fn with_year(year: u32) -> MonthSetter
pub fn with_year(year: u32) -> MonthSetter
Creates a TimestampBuilder with the specified year and Precision::Year.
sourcepub fn with_ymd(year: u32, month: u32, day: u32) -> HourAndMinuteSetter
pub fn with_ymd(year: u32, month: u32, day: u32) -> HourAndMinuteSetter
Creates a TimestampBuilder with the specified year, month, and day. Its precision is set to Precision::Day.
sourcepub fn with_ymd_hms(
year: u32,
month: u32,
day: u32,
hour: u32,
minute: u32,
second: u32
) -> FractionalSecondSetter
pub fn with_ymd_hms(
year: u32,
month: u32,
day: u32,
hour: u32,
minute: u32,
second: u32
) -> FractionalSecondSetter
Creates a TimestampBuilder with the specified year, month, day, hour, minute, and second. Its precision is set to Precision::Second.
sourcepub fn with_ymd_hms_millis(
year: u32,
month: u32,
day: u32,
hour: u32,
minute: u32,
second: u32,
milliseconds: u32
) -> FractionalSecondSetter
pub fn with_ymd_hms_millis(
year: u32,
month: u32,
day: u32,
hour: u32,
minute: u32,
second: u32,
milliseconds: u32
) -> FractionalSecondSetter
Creates a TimestampBuilder with the specified year, month, day, hour, minute, second and milliseconds. Its precision is set to Precision::FractionalSeconds.
Trait Implementations
sourceimpl From<DateTime<FixedOffset>> for Timestamp
impl From<DateTime<FixedOffset>> for Timestamp
sourcefn from(fixed_offset_date_time: DateTime<FixedOffset>) -> Self
fn from(fixed_offset_date_time: DateTime<FixedOffset>) -> Self
Converts to this type from the input type.
sourceimpl From<IonDateTime> for Timestamp
impl From<IonDateTime> for Timestamp
sourcefn from(ionc_dt: IonDateTime) -> Self
fn from(ionc_dt: IonDateTime) -> Self
Converts to this type from the input type.
sourceimpl From<NaiveDateTime> for Timestamp
impl From<NaiveDateTime> for Timestamp
sourcefn from(date_time: NaiveDateTime) -> Self
fn from(date_time: NaiveDateTime) -> Self
Converts to this type from the input type.
sourceimpl<'val> From<Timestamp> for BorrowedElement<'val>
impl<'val> From<Timestamp> for BorrowedElement<'val>
sourceimpl From<Timestamp> for OwnedElement
impl From<Timestamp> for OwnedElement
sourceimpl TryInto<DateTime<FixedOffset>> for Timestamp
impl TryInto<DateTime<FixedOffset>> for Timestamp
sourceimpl TryInto<IonDateTime> for Timestamp
impl TryInto<IonDateTime> for Timestamp
In general there should be 1-to-1 fidelity between these types, but there
is no static way to guarantee this because of Decimal
and the public constructor for
IonDateTime
.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more