pub struct PhpDateTime { /* private fields */ }Expand description
A date and time with its time zone: what DateTime::format() prints and createFromFormat() returns.
Build one from a jiff civil::DateTime (read as UTC), a Timestamp (UTC), a ZonedDateTime, or with
PhpDateTime::new.
Implementations§
Source§impl PhpDateTime
impl PhpDateTime
Sourcepub fn new(local: DateTime, zone: Zone) -> Result<Self, Error>
pub fn new(local: DateTime, zone: Zone) -> Result<Self, Error>
A wall-clock time in zone. A time that does not exist there (the hour a daylight saving change skips)
moves forward as PHP moves it, and a time that happens twice is the first one.
§Errors
When the result falls outside the dates jiff supports (years -9999 to 9999).
Sourcepub fn from_utc(utc: DateTime, zone: Zone) -> Result<Self, Error>
pub fn from_utc(utc: DateTime, zone: Zone) -> Result<Self, Error>
The instant utc (a UTC wall-clock time) seen from zone.
§Errors
When the result falls outside the dates jiff supports.
Sourcepub fn from_timestamp(timestamp: Timestamp, zone: Zone) -> Result<Self, Error>
pub fn from_timestamp(timestamp: Timestamp, zone: Zone) -> Result<Self, Error>
The instant timestamp seen from zone.
§Errors
When the result falls outside the dates jiff supports.
Sourcepub const fn offset_seconds(&self) -> i32
pub const fn offset_seconds(&self) -> i32
Seconds east of UTC at this instant (Z).
Sourcepub fn to_timestamp(&self) -> Result<Timestamp, Error>
pub fn to_timestamp(&self) -> Result<Timestamp, Error>
Sourcepub fn to_zoned_datetime(&self) -> Result<ZonedDateTime, Error>
pub fn to_zoned_datetime(&self) -> Result<ZonedDateTime, Error>
The instant as a jiff ZonedDateTime.
§Errors
When the instant falls outside the range jiff supports.
Trait Implementations§
Source§impl Clone for PhpDateTime
impl Clone for PhpDateTime
Source§impl Debug for PhpDateTime
impl Debug for PhpDateTime
impl Eq for PhpDateTime
Source§impl From<&PhpDateTime> for PhpDateTime
impl From<&PhpDateTime> for PhpDateTime
Source§impl From<Timestamp> for PhpDateTime
impl From<Timestamp> for PhpDateTime
Source§impl From<ZonedDateTime> for PhpDateTime
impl From<ZonedDateTime> for PhpDateTime
Source§fn from(date: ZonedDateTime) -> Self
fn from(date: ZonedDateTime) -> Self
Source§impl PartialEq for PhpDateTime
impl PartialEq for PhpDateTime
impl StructuralPartialEq for PhpDateTime
Auto Trait Implementations§
impl Forget for PhpDateTime
impl Freeze for PhpDateTime
impl Move for PhpDateTime
impl RefUnwindSafe for PhpDateTime
impl Send for PhpDateTime
impl Sync for PhpDateTime
impl Unpin for PhpDateTime
impl UnsafeUnpin for PhpDateTime
impl UnwindSafe for PhpDateTime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.