pub trait DateTimeExt {
// Required methods
fn now() -> Self;
fn to_unix_timestamp(&self) -> i64;
fn from_unix_timestamp(secs: i64) -> Self;
}Expand description
Extension trait for SQL datetime operations.
This trait provides a unified API for datetime operations regardless of
whether chrono or time feature is enabled.
Required Methods§
Sourcefn to_unix_timestamp(&self) -> i64
fn to_unix_timestamp(&self) -> i64
Returns the Unix timestamp (seconds since epoch).
Sourcefn from_unix_timestamp(secs: i64) -> Self
fn from_unix_timestamp(secs: i64) -> Self
Creates a datetime from Unix timestamp (seconds since epoch).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl DateTimeExt for DateTime
Available on crate feature
chrono and non-crate feature time only.