pub struct Time { /* private fields */ }
Implementations§
Methods from Deref<Target = DateTime<Local>>§
Sourcepub fn time(&self) -> NaiveTime
pub fn time(&self) -> NaiveTime
Retrieves a time component.
Unlike date
, this is not associated to the time zone.
Sourcepub fn timestamp(&self) -> i64
pub fn timestamp(&self) -> i64
Returns the number of non-leap seconds since January 1, 1970 0:00:00 UTC (aka “UNIX timestamp”).
Sourcepub fn timestamp_subsec_millis(&self) -> u32
pub fn timestamp_subsec_millis(&self) -> u32
Returns the number of milliseconds since the last second boundary
warning: in event of a leap second, this may exceed 999
note: this is not the number of milliseconds since January 1, 1970 0:00:00 UTC
Sourcepub fn timestamp_subsec_micros(&self) -> u32
pub fn timestamp_subsec_micros(&self) -> u32
Returns the number of microseconds since the last second boundary
warning: in event of a leap second, this may exceed 999_999
note: this is not the number of microseconds since January 1, 1970 0:00:00 UTC
Sourcepub fn timestamp_subsec_nanos(&self) -> u32
pub fn timestamp_subsec_nanos(&self) -> u32
Returns the number of nanoseconds since the last second boundary
warning: in event of a leap second, this may exceed 999_999_999
note: this is not the number of nanoseconds since January 1, 1970 0:00:00 UTC
Sourcepub fn num_seconds_from_unix_epoch(&self) -> i64
pub fn num_seconds_from_unix_epoch(&self) -> i64
Deprecated: Same to DateTime::timestamp
.
Sourcepub fn offset<'a>(&'a self) -> &'a <Tz as TimeZone>::Offset
pub fn offset<'a>(&'a self) -> &'a <Tz as TimeZone>::Offset
Retrieves an associated offset from UTC.
Sourcepub fn with_timezone<Tz2>(&self, tz: &Tz2) -> DateTime<Tz2>where
Tz2: TimeZone,
pub fn with_timezone<Tz2>(&self, tz: &Tz2) -> DateTime<Tz2>where
Tz2: TimeZone,
Changes the associated time zone.
This does not change the actual DateTime
(but will change the string representation).
Sourcepub fn naive_utc(&self) -> NaiveDateTime
pub fn naive_utc(&self) -> NaiveDateTime
Returns a view to the naive UTC datetime.
Sourcepub fn naive_local(&self) -> NaiveDateTime
pub fn naive_local(&self) -> NaiveDateTime
Returns a view to the naive local datetime.
Sourcepub fn to_rfc2822(&self) -> String
pub fn to_rfc2822(&self) -> String
Returns an RFC 2822 date and time string such as Tue, 1 Jul 2003 10:52:37 +0200
.
Sourcepub fn to_rfc3339(&self) -> String
pub fn to_rfc3339(&self) -> String
Returns an RFC 3339 and ISO 8601 date and time string such as 1996-12-19T16:39:57-08:00
.
Sourcepub fn format_with_items<'a, I>(&self, items: I) -> DelayedFormat<I>
pub fn format_with_items<'a, I>(&self, items: I) -> DelayedFormat<I>
Formats the combined date and time with the specified formatting items.
Sourcepub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>
pub fn format<'a>(&self, fmt: &'a str) -> DelayedFormat<StrftimeItems<'a>>
Formats the combined date and time with the specified format string.
See the format::strftime
module
on the supported escape sequences.
Trait Implementations§
Source§impl FromRedisValue for Time
impl FromRedisValue for Time
Source§fn from_redis_value(v: &Value) -> RedisResult<Self>
fn from_redis_value(v: &Value) -> RedisResult<Self>
Value
this attempts to convert it into the given
destination type. If that fails because it’s not compatible an
appropriate error is generated.Source§fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
fn from_redis_values(items: &[Value]) -> Result<Vec<Self>, RedisError>
from_redis_value
but constructs a vector of objects
from another vector of values. This primarily exists internally
to customize the behavior for vectors of tuples.Source§impl FromSql for Time
impl FromSql for Time
Source§fn from_sql<R: Read>(
ty: &Type,
raw: &mut R,
ctx: &SessionInfo<'_>,
) -> Result<Time>
fn from_sql<R: Read>( ty: &Type, raw: &mut R, ctx: &SessionInfo<'_>, ) -> Result<Time>
Read
er of the binary format
of the specified Postgres Type
. Read moreSource§fn accepts(_: &Type) -> bool
fn accepts(_: &Type) -> bool
Type
.Source§fn from_sql_null(ty: &Type, ctx: &SessionInfo<'_>) -> Result<Self, Error>
fn from_sql_null(ty: &Type, ctx: &SessionInfo<'_>) -> Result<Self, Error>
NULL
SQL value. Read moreSource§impl ToRedisArgs for Time
impl ToRedisArgs for Time
Source§fn to_redis_args(&self) -> Vec<Vec<u8>>
fn to_redis_args(&self) -> Vec<Vec<u8>>
Source§fn describe_numeric_behavior(&self) -> NumericBehavior
fn describe_numeric_behavior(&self) -> NumericBehavior
INCR
vs INCRBYFLOAT
).Source§fn is_single_arg(&self) -> bool
fn is_single_arg(&self) -> bool
GET
and MGET
variants.Source§impl ToSql for Time
impl ToSql for Time
Source§fn to_sql<W: Write + ?Sized>(
&self,
ty: &Type,
w: &mut W,
ctx: &SessionInfo<'_>,
) -> Result<IsNull>
fn to_sql<W: Write + ?Sized>( &self, ty: &Type, w: &mut W, ctx: &SessionInfo<'_>, ) -> Result<IsNull>
self
into the binary format of the specified
Postgres Type
, writing it to out
. Read moreSource§fn accepts(_: &Type) -> bool
fn accepts(_: &Type) -> bool
Type
.Source§fn to_sql_checked(
&self,
ty: &Type,
out: &mut dyn Write,
ctx: &SessionInfo<'_>,
) -> Result<IsNull>
fn to_sql_checked( &self, ty: &Type, out: &mut dyn Write, ctx: &SessionInfo<'_>, ) -> Result<IsNull>
impl Copy for Time
impl Eq for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)