Trait time_tz::PrimitiveDateTimeExt
source · pub trait PrimitiveDateTimeExt: PrimitiveDateTimeExt {
// Required methods
fn assume_timezone<T: TimeZone>(
&self,
tz: &T
) -> OffsetResult<OffsetDateTime>;
fn assume_timezone_utc<T: TimeZone>(&self, tz: &T) -> OffsetDateTime;
}
Expand description
This trait is sealed and is only implemented in this library.
Required Methods§
sourcefn assume_timezone<T: TimeZone>(&self, tz: &T) -> OffsetResult<OffsetDateTime>
fn assume_timezone<T: TimeZone>(&self, tz: &T) -> OffsetResult<OffsetDateTime>
Creates a new OffsetDateTime from a PrimitiveDateTime by assigning the main offset of the target timezone.
This assumes the PrimitiveDateTime is already in the target timezone.
Arguments
tz
: the target timezone.
returns: OffsetResult<OffsetDateTime>
sourcefn assume_timezone_utc<T: TimeZone>(&self, tz: &T) -> OffsetDateTime
fn assume_timezone_utc<T: TimeZone>(&self, tz: &T) -> OffsetDateTime
Creates a new OffsetDateTime with the proper offset in the given timezone.
This assumes the PrimitiveDateTime is in UTC offset.
Arguments
tz
: the target timezone.
returns: OffsetDateTime