pub struct Date(/* private fields */);Implementations§
Source§impl Date
impl Date
Sourcepub fn from_ymd(year: isize, month: usize, day: usize) -> Self
pub fn from_ymd(year: isize, month: usize, day: usize) -> Self
Creates a date from a given year, month, and day number.
Sourcepub fn and_hms(
&self,
hour: usize,
minute: usize,
second: usize,
zone: Zone,
) -> Time
pub fn and_hms( &self, hour: usize, minute: usize, second: usize, zone: Zone, ) -> Time
Converts the date to a time in the given time zone with the given hour, minute, and second.
Sourcepub fn format<'a>(&self, fmt: &'a str) -> impl Display + 'a
pub fn format<'a>(&self, fmt: &'a str) -> impl Display + 'a
Formats the date according to the given format string.
Sourcepub fn to_local_time(&self) -> Time
pub fn to_local_time(&self) -> Time
Convert the date to a time in the local time zone.
Sourcepub fn to_utc_time(&self) -> Time
pub fn to_utc_time(&self) -> Time
Convert the date to a time in UTC.
Trait Implementations§
Source§impl<'a> FromSql<'a> for Date
impl<'a> FromSql<'a> for Date
Source§fn from_sql(
ty: &Type,
raw: &'a [u8],
) -> Result<Self, Box<dyn Error + Sync + Send>>
fn from_sql( ty: &Type, raw: &'a [u8], ) -> Result<Self, Box<dyn Error + Sync + Send>>
Creates a new value of this type from a buffer of data of the specified
Postgres
Type in its binary format. Read moreSource§fn accepts(ty: &Type) -> bool
fn accepts(ty: &Type) -> bool
Determines if a value of this type can be created from the specified
Postgres
Type.Source§impl Ord for Date
impl Ord for Date
Source§impl PartialOrd for Date
impl PartialOrd for Date
Source§impl ToSql for Date
impl ToSql for Date
Source§fn to_sql(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn to_sql(
&self,
ty: &Type,
out: &mut BytesMut,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
Converts the value of
self into the binary format of the specified
Postgres Type, appending it to out. Read moreimpl Copy for Date
impl Eq for Date
impl StructuralPartialEq for Date
Auto Trait Implementations§
impl Freeze for Date
impl RefUnwindSafe for Date
impl Send for Date
impl Sync for Date
impl Unpin for Date
impl UnwindSafe for Date
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
Mutably borrows from an owned value. Read more
Source§impl<T> BorrowToSql for Twhere
T: ToSql,
impl<T> BorrowToSql for Twhere
T: ToSql,
Source§fn borrow_to_sql(&self) -> &dyn ToSql
fn borrow_to_sql(&self) -> &dyn ToSql
Returns a reference to
self as a ToSql trait object.