Struct sqlx::types::chrono::Utc[][src]

pub struct Utc;
Expand description

The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).

Using the TimeZone methods on the UTC struct is the preferred way to construct DateTime<Utc> instances.

Example

use chrono::{DateTime, TimeZone, NaiveDateTime, Utc};

let dt = DateTime::<Utc>::from_utc(NaiveDateTime::from_timestamp(61, 0), Utc);

assert_eq!(Utc.timestamp(61, 0), dt);
assert_eq!(Utc.ymd(1970, 1, 1).and_hms(0, 1, 1), dt);

Implementations

Returns a Date which corresponds to the current date.

Returns a DateTime which corresponds to the current date.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Returns the fixed offset from UTC to the local time stored.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

An associated offset type. This type is used to store the actual offset in date and time types. The original TimeZone value can be recovered via TimeZone::from_offset. Read more

Reconstructs the time zone from the offset.

Creates the offset(s) for given local NaiveDate if possible.

Creates the offset(s) for given local NaiveDateTime if possible.

Creates the offset for given UTC NaiveDate. This cannot fail.

Creates the offset for given UTC NaiveDateTime. This cannot fail.

Makes a new Date from year, month, day and the current time zone. This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE. Read more

Makes a new Date from year, month, day and the current time zone. This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE. Read more

Makes a new Date from year, day of year (DOY or “ordinal”) and the current time zone. This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE. Read more

Makes a new Date from year, day of year (DOY or “ordinal”) and the current time zone. This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE. Read more

Makes a new Date from ISO week date (year and week number), day of the week (DOW) and the current time zone. This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE. The resulting Date may have a different year from the input year. Read more

Makes a new Date from ISO week date (year and week number), day of the week (DOW) and the current time zone. This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE. The resulting Date may have a different year from the input year. Read more

Makes a new DateTime from the number of non-leap seconds since January 1, 1970 0:00:00 UTC (aka “UNIX timestamp”) and the number of nanoseconds since the last whole non-leap second. Read more

Makes a new DateTime from the number of non-leap seconds since January 1, 1970 0:00:00 UTC (aka “UNIX timestamp”) and the number of nanoseconds since the last whole non-leap second. Read more

Makes a new DateTime from the number of non-leap milliseconds since January 1, 1970 0:00:00 UTC (aka “UNIX timestamp”). Read more

Makes a new DateTime from the number of non-leap milliseconds since January 1, 1970 0:00:00 UTC (aka “UNIX timestamp”). Read more

Makes a new DateTime from the number of non-leap nanoseconds since January 1, 1970 0:00:00 UTC (aka “UNIX timestamp”). Read more

Parses a string with the specified format string and returns a DateTime with the current offset. See the format::strftime module on the supported escape sequences. Read more

Converts the local NaiveDate to the timezone-aware Date if possible.

Converts the local NaiveDateTime to the timezone-aware DateTime if possible.

Converts the UTC NaiveDate to the local time. The UTC is continuous and thus this cannot fail (but can give the duplicate local time). Read more

Converts the UTC NaiveDateTime to the local time. The UTC is continuous and thus this cannot fail (but can give the duplicate local time). Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Converts self into T using Into<T>. Read more

Converts self into a target type. Read more

Compare self to key and return true if they are equal.

Causes self to use its Binary implementation when Debug-formatted.

Causes self to use its Display implementation when Debug-formatted. Read more

Causes self to use its LowerExp implementation when Debug-formatted. Read more

Causes self to use its LowerHex implementation when Debug-formatted. Read more

Causes self to use its Octal implementation when Debug-formatted.

Causes self to use its Pointer implementation when Debug-formatted. Read more

Causes self to use its UpperExp implementation when Debug-formatted. Read more

Causes self to use its UpperHex implementation when Debug-formatted. Read more

Performs the conversion.

Performs the conversion.

Pipes by value. This is generally the method you want to use. Read more

Borrows self and passes that borrow into the pipe function. Read more

Mutably borrows self and passes that borrow into the pipe function. Read more

Borrows self, then passes self.borrow() into the pipe function. Read more

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

Borrows self, then passes self.as_ref() into the pipe function.

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

Borrows self, then passes self.deref() into the pipe function.

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

Pipes a value into a function that cannot ordinarily be called in suffix position. Read more

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more

Pipes a dereference into a function that cannot normally be called in suffix position. Read more

Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more

Pipes a reference into a function that cannot ordinarily be called in suffix position. Read more

Pipes a mutable reference into a function that cannot ordinarily be called in suffix position. Read more

Should always be Self

Immutable access to a value. Read more

Mutable access to a value. Read more

Immutable access to the Borrow<B> of a value. Read more

Mutable access to the BorrowMut<B> of a value. Read more

Immutable access to the AsRef<R> view of a value. Read more

Mutable access to the AsMut<R> view of a value. Read more

Immutable access to the Deref::Target of a value. Read more

Mutable access to the Deref::Target of a value. Read more

Calls .tap() only in debug builds, and is erased in release builds.

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

Provides immutable access for inspection. Read more

Calls tap in debug builds, and does nothing in release builds.

Provides mutable access for modification. Read more

Calls tap_mut in debug builds, and does nothing in release builds.

Provides immutable access to the reference for inspection.

Calls tap_ref in debug builds, and does nothing in release builds.

Provides mutable access to the reference for modification.

Calls tap_ref_mut in debug builds, and does nothing in release builds.

Provides immutable access to the borrow for inspection. Read more

Calls tap_borrow in debug builds, and does nothing in release builds.

Provides mutable access to the borrow for modification.

Calls tap_borrow_mut in debug builds, and does nothing in release builds. Read more

Immutably dereferences self for inspection.

Calls tap_deref in debug builds, and does nothing in release builds.

Mutably dereferences self for modification.

Calls tap_deref_mut in debug builds, and does nothing in release builds. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

Attempts to convert self into T using TryInto<T>. Read more

Attempts to convert self into a target type. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.