mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-27 20:30:52 +01:00
516 lines
215 KiB
HTML
516 lines
215 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="ISO 8601 combined date and time with time zone."><title>DateTime in chrono - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-ac92e1bbe349e143.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="chrono" data-themes="" data-resource-suffix="" data-rustdoc-version="1.76.0 (07dca489a 2024-02-04)" data-channel="1.76.0" data-search-js="search-2b6ce74ff89ae146.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-f2adc0d6ca4d09fb.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-305769736d49e732.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-feafe1bb7466e4bd.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../chrono/index.html">chrono</a><span class="version">0.4.31</span></h2></div><h2 class="location"><a href="#">DateTime</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Associated Constants</a></h3><ul class="block associatedconstant"><li><a href="#associatedconstant.MAX_UTC">MAX_UTC</a></li><li><a href="#associatedconstant.MIN_UTC">MIN_UTC</a></li><li><a href="#associatedconstant.UNIX_EPOCH">UNIX_EPOCH</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.checked_add_days">checked_add_days</a></li><li><a href="#method.checked_add_months">checked_add_months</a></li><li><a href="#method.checked_add_signed">checked_add_signed</a></li><li><a href="#method.checked_sub_days">checked_sub_days</a></li><li><a href="#method.checked_sub_months">checked_sub_months</a></li><li><a href="#method.checked_sub_signed">checked_sub_signed</a></li><li><a href="#method.date">date</a></li><li><a href="#method.date_naive">date_naive</a></li><li><a href="#method.fixed_offset">fixed_offset</a></li><li><a href="#method.format">format</a></li><li><a href="#method.format_with_items">format_with_items</a></li><li><a href="#method.from_local">from_local</a></li><li><a href="#method.from_naive_utc_and_offset">from_naive_utc_and_offset</a></li><li><a href="#method.from_timestamp">from_timestamp</a></li><li><a href="#method.from_utc">from_utc</a></li><li><a href="#method.naive_local">naive_local</a></li><li><a href="#method.naive_utc">naive_utc</a></li><li><a href="#method.offset">offset</a></li><li><a href="#method.parse_and_remainder">parse_and_remainder</a></li><li><a href="#method.parse_from_rfc2822">parse_from_rfc2822</a></li><li><a href="#method.parse_from_rfc3339">parse_from_rfc3339</a></li><li><a href="#method.parse_from_str">parse_from_str</a></li><li><a href="#method.signed_duration_since">signed_duration_since</a></li><li><a href="#method.time">time</a></li><li><a href="#method.timestamp">timestamp</a></li><li><a href="#method.timestamp_micros">timestamp_micros</a></li><li><a href="#method.timestamp_millis">timestamp_millis</a></li><li><a href="#method.timestamp_nanos">timestamp_nanos</a></li><li><a href="#method.timestamp_nanos_opt">timestamp_nanos_opt</a></li><li><a href="#method.timestamp_subsec_micros">timestamp_subsec_micros</a></li><li><a href="#method.timestamp_subsec_millis">timestamp_subsec_millis</a></li><li><a href="#method.timestamp_subsec_nanos">timestamp_subsec_nanos</a></li><li><a href="#method.timezone">timezone</a></li><li><a href="#method.to_rfc2822">to_rfc2822</a></li><li><a href="#method.to_rfc3339">to_rfc3339</a></li><li><a href="#method.to_rfc3339_opts">to_rfc3339_opts</a></li><li><a href="#method.with_timezone">with_timezone</a></li><li><a href="#method.years_since">years_since</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Add%3CDays%3E-for-DateTime%3CTz%3E">Add<Days></a></li><li><a href="#impl-Add%3CDuration%3E-for-DateTime%3CTz%3E">Add<Duration></a></li><li><a href="#impl-Add%3CDuration%3E-for-DateTime%3CTz%3E-1">Add<Duration></a></li><li><a href="#impl-Add%3CFixedOffset%3E-for-DateTime%3CTz%3E">Add<FixedOffset></a></li><li><a href="#impl-Add%3CMonths%3E-for-DateTime%3CTz%3E">Add<Months></a></li><li><a href="#impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E">AddAssign<Duration></a></li><li><a href="#impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E-1">AddAssign<Duration></a></li><li><a href="#impl-Clone-for-DateTime%3CTz%3E">Clone</a></li><li><a href="#impl-Copy-for-DateTime%3CTz%3E">Copy</a></li><li><a href="#impl-Datelike-for-DateTime%3CTz%3E">Datelike</a></li><li><a href="#impl-Debug-for-DateTime%3CTz%3E">Debug</a></li><li><a href="#impl-Default-for-DateTime%3CFixedOffset%3E">Default</a></li><li><a href="#impl-Default-for-DateTime%3CLocal%3E">Default</a></li><li><a href="#impl-Default-for-DateTime%3CUtc%3E">Default</a></li><li><a href="#impl-Deserialize%3C'de%3E-for-DateTime%3CFixedOffset%3E">Deserialize<'de></a></li><li><a href="#impl-Deserialize%3C'de%3E-for-DateTime%3CLocal%3E">Deserialize<'de></a></li><li><a href="#impl-Deserialize%3C'de%3E-for-DateTime%3CUtc%3E">Deserialize<'de></a></li><li><a href="#impl-Display-for-DateTime%3CTz%3E">Display</a></li><li><a href="#impl-DurationRound-for-DateTime%3CTz%3E">DurationRound</a></li><li><a href="#impl-Eq-for-DateTime%3CTz%3E">Eq</a></li><li><a href="#impl-From%3CDateTime%3CFixedOffset%3E%3E-for-DateTime%3CLocal%3E">From<DateTime<FixedOffset>></a></li><li><a href="#impl-From%3CDateTime%3CFixedOffset%3E%3E-for-DateTime%3CUtc%3E">From<DateTime<FixedOffset>></a></li><li><a href="#impl-From%3CDateTime%3CLocal%3E%3E-for-DateTime%3CFixedOffset%3E">From<DateTime<Local>></a></li><li><a href="#impl-From%3CDateTime%3CLocal%3E%3E-for-DateTime%3CUtc%3E">From<DateTime<Local>></a></li><li><a href="#impl-From%3CDateTime%3CTz%3E%3E-for-SystemTime">From<DateTime<Tz>></a></li><li><a href="#impl-From%3CDateTime%3CUtc%3E%3E-for-DateTime%3CFixedOffset%3E">From<DateTime<Utc>></a></li><li><a href="#impl-From%3CDateTime%3CUtc%3E%3E-for-DateTime%3CLocal%3E">From<DateTime<Utc>></a></li><li><a href="#impl-From%3CSystemTime%3E-for-DateTime%3CLocal%3E">From<SystemTime></a></li><li><a href="#impl-From%3CSystemTime%3E-for-DateTime%3CUtc%3E">From<SystemTime></a></li><li><a href="#impl-FromStr-for-DateTime%3CFixedOffset%3E">FromStr</a></li><li><a href="#impl-FromStr-for-DateTime%3CLocal%3E">FromStr</a></li><li><a href="#impl-FromStr-for-DateTime%3CUtc%3E">FromStr</a></li><li><a href="#impl-Hash-for-DateTime%3CTz%3E">Hash</a></li><li><a href="#impl-Ord-for-DateTime%3CTz%3E">Ord</a></li><li><a href="#impl-PartialEq%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E">PartialEq<DateTime<Tz2>></a></li><li><a href="#impl-PartialOrd%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E">PartialOrd<DateTime<Tz2>></a></li><li><a href="#impl-Send-for-DateTime%3CTz%3E">Send</a></li><li><a href="#impl-Serialize-for-DateTime%3CTz%3E">Serialize</a></li><li><a href="#impl-Sub-for-DateTime%3CTz%3E">Sub</a></li><li><a href="#impl-Sub%3C%26DateTime%3CTz%3E%3E-for-DateTime%3CTz%3E">Sub<&DateTime<Tz>></a></li><li><a href="#impl-Sub%3CDays%3E-for-DateTime%3CTz%3E">Sub<Days></a></li><li><a href="#impl-Sub%3CDuration%3E-for-DateTime%3CTz%3E">Sub<Duration></a></li><li><a href="#impl-Sub%3CDuration%3E-for-DateTime%3CTz%3E-1">Sub<Duration></a></li><li><a href="#impl-Sub%3CFixedOffset%3E-for-DateTime%3CTz%3E">Sub<FixedOffset></a></li><li><a href="#impl-Sub%3CMonths%3E-for-DateTime%3CTz%3E">Sub<Months></a></li><li><a href="#impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E">SubAssign<Duration></a></li><li><a href="#impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E-1">SubAssign<Duration></a></li><li><a href="#impl-Timelike-for-DateTime%3CTz%3E">Timelike</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-RefUnwindSafe-for-DateTime%3CTz%3E">RefUnwindSafe</a></li><li><a href="#impl-Sync-for-DateTime%3CTz%3E">Sync</a></li><li><a href="#impl-Unpin-for-DateTime%3CTz%3E">Unpin</a></li><li><a href="#impl-UnwindSafe-for-DateTime%3CTz%3E">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut<T></a></li><li><a href="#impl-DeserializeOwned-for-T">DeserializeOwned</a></li><li><a href="#impl-From%3CT%3E-for-T">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T">Into<U></a></li><li><a href="#impl-SubsecRound-for-T">SubsecRound</a></li><li><a href="#impl-ToOwned-for-T">ToOwned</a></li><li><a href="#impl-ToString-for-T">ToString</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto<U></a></li></ul></section><h2><a href="index.html">In crate chrono</a></h2></div></nav><div class="sidebar-resizer"></div>
|
||
<main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><div id="sidebar-button" tabindex="-1"><a href="../chrono/all.html" title="show sidebar"></a></div><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" tabindex="-1"><a href="../help.html" title="help">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="index.html">chrono</a>::<wbr><a class="struct" href="#">DateTime</a><button id="copy-path" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../src/chrono/datetime/mod.rs.html#86-89">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub struct DateTime<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> { <span class="comment">/* private fields */</span> }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>ISO 8601 combined date and time with time zone.</p>
|
||
<p>There are some constructors implemented here (the <code>from_*</code> methods), but
|
||
the general-purpose constructors are all via the methods on the
|
||
<a href="./offset/trait.TimeZone.html"><code>TimeZone</code></a> implementations.</p>
|
||
</div></details><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#98-589">source</a><a href="#impl-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_naive_utc_and_offset" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#123-125">source</a><h4 class="code-header">pub fn <a href="#method.from_naive_utc_and_offset" class="fn">from_naive_utc_and_offset</a>(
|
||
datetime: <a class="struct" href="naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a>,
|
||
offset: Tz::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>
|
||
) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> from its components: a <code>NaiveDateTime</code> in UTC and an <code>Offset</code>.</p>
|
||
<p>This is a low-level method, intended for use cases such as deserializing a <code>DateTime</code> or
|
||
passing it through FFI.</p>
|
||
<p>For regular use you will probably want to use a method such as
|
||
<a href="offset/trait.TimeZone.html#method.from_local_datetime" title="method chrono::offset::TimeZone::from_local_datetime"><code>TimeZone::from_local_datetime</code></a> or <a href="naive/struct.NaiveDateTime.html#method.and_local_timezone" title="method chrono::naive::NaiveDateTime::and_local_timezone"><code>NaiveDateTime::and_local_timezone</code></a> instead.</p>
|
||
<h5 id="example"><a href="#example">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{Local, DateTime};
|
||
|
||
<span class="kw">let </span>dt = Local::now();
|
||
<span class="comment">// Get components
|
||
</span><span class="kw">let </span>naive_utc = dt.naive_utc();
|
||
<span class="kw">let </span>offset = dt.offset().clone();
|
||
<span class="comment">// Serialize, pass through FFI... and recreate the `DateTime`:
|
||
</span><span class="kw">let </span>dt_new = DateTime::<Local>::from_naive_utc_and_offset(naive_utc, offset);
|
||
<span class="macro">assert_eq!</span>(dt, dt_new);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_utc" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#134-136">source</a><h4 class="code-header">pub fn <a href="#method.from_utc" class="fn">from_utc</a>(datetime: <a class="struct" href="naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a>, offset: Tz::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.4.27: Use TimeZone::from_utc_datetime() or DateTime::from_naive_utc_and_offset instead</span></div></span></summary><div class="docblock"><p>Makes a new <code>DateTime</code> from its components: a <code>NaiveDateTime</code> in UTC and an <code>Offset</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_local" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#152-156">source</a><h4 class="code-header">pub fn <a href="#method.from_local" class="fn">from_local</a>(datetime: <a class="struct" href="naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a>, offset: Tz::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.4.27: Use TimeZone::from_local_datetime() or NaiveDateTime::and_local_timezone instead</span></div></span></summary><div class="docblock"><p>Makes a new <code>DateTime</code> from a <code>NaiveDateTime</code> in <em>local</em> time and an <code>Offset</code>.</p>
|
||
<h5 id="panics"><a href="#panics">Panics</a></h5>
|
||
<p>Panics if the local datetime can’t be converted to UTC because it would be out of range.</p>
|
||
<p>This can happen if <code>datetime</code> is near the end of the representable range of <code>NaiveDateTime</code>,
|
||
and the offset from UTC pushes it beyond that.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.date" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#175-177">source</a><h4 class="code-header">pub fn <a href="#method.date" class="fn">date</a>(&self) -> <a class="struct" href="struct.Date.html" title="struct chrono::Date">Date</a><Tz></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.4.23: Use <code>date_naive()</code> instead</span></div></span></summary><div class="docblock"><p>Retrieves the date component with an associated timezone.</p>
|
||
<p>Unless you are immediately planning on turning this into a <code>DateTime</code>
|
||
with the same timezone you should use the <a href="struct.DateTime.html#method.date_naive" title="method chrono::DateTime::date_naive"><code>date_naive</code></a> method.</p>
|
||
<p><a href="naive/struct.NaiveDate.html" title="struct chrono::naive::NaiveDate"><code>NaiveDate</code></a> is a more well-defined type, and has more traits implemented on it,
|
||
so should be preferred to <a href="struct.Date.html" title="struct chrono::Date"><code>Date</code></a> any time you truly want to operate on dates.</p>
|
||
<h5 id="panics-1"><a href="#panics-1">Panics</a></h5>
|
||
<p><a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a> internally stores the date and time in UTC with a <a href="naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime"><code>NaiveDateTime</code></a>. This
|
||
method will panic if the offset from UTC would push the local date outside of the
|
||
representable range of a <a href="struct.Date.html" title="struct chrono::Date"><code>Date</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.date_naive" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#198-201">source</a><h4 class="code-header">pub fn <a href="#method.date_naive" class="fn">date_naive</a>(&self) -> <a class="struct" href="naive/struct.NaiveDate.html" title="struct chrono::naive::NaiveDate">NaiveDate</a></h4></section></summary><div class="docblock"><p>Retrieves the date component.</p>
|
||
<h5 id="panics-2"><a href="#panics-2">Panics</a></h5>
|
||
<p><a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a> internally stores the date and time in UTC with a <a href="naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime"><code>NaiveDateTime</code></a>. This
|
||
method will panic if the offset from UTC would push the local date outside of the
|
||
representable range of a <a href="naive/struct.NaiveDate.html" title="struct chrono::naive::NaiveDate"><code>NaiveDate</code></a>.</p>
|
||
<h5 id="example-1"><a href="#example-1">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>date: DateTime<Utc> = Utc.with_ymd_and_hms(<span class="number">2020</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).unwrap();
|
||
<span class="kw">let </span>other: DateTime<FixedOffset> = FixedOffset::east_opt(<span class="number">23</span>).unwrap().with_ymd_and_hms(<span class="number">2020</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).unwrap();
|
||
<span class="macro">assert_eq!</span>(date.date_naive(), other.date_naive());</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.time" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#206-208">source</a><h4 class="code-header">pub fn <a href="#method.time" class="fn">time</a>(&self) -> <a class="struct" href="naive/struct.NaiveTime.html" title="struct chrono::naive::NaiveTime">NaiveTime</a></h4></section></summary><div class="docblock"><p>Retrieves the time component.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#226-228">source</a><h4 class="code-header">pub fn <a href="#method.timestamp" class="fn">timestamp</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.i64.html">i64</a></h4></section></summary><div class="docblock"><p>Returns the number of non-leap seconds since January 1, 1970 0:00:00 UTC
|
||
(aka “UNIX timestamp”).</p>
|
||
<p>The reverse operation of creating a <a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a> from a timestamp can be performed
|
||
using <a href="struct.DateTime.html#method.from_timestamp" title="associated function chrono::DateTime::from_timestamp"><code>from_timestamp</code></a> or <a href="offset/trait.TimeZone.html#method.timestamp_opt" title="method chrono::offset::TimeZone::timestamp_opt"><code>TimeZone::timestamp_opt</code></a>.</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{DateTime, TimeZone, Utc};
|
||
|
||
<span class="kw">let </span>dt: DateTime<Utc> = Utc.with_ymd_and_hms(<span class="number">2015</span>, <span class="number">5</span>, <span class="number">15</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).unwrap();
|
||
<span class="macro">assert_eq!</span>(dt.timestamp(), <span class="number">1431648000</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(DateTime::from_timestamp(dt.timestamp(), dt.timestamp_subsec_nanos()).unwrap(), dt);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_millis" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#245-247">source</a><h4 class="code-header">pub fn <a href="#method.timestamp_millis" class="fn">timestamp_millis</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.i64.html">i64</a></h4></section></summary><div class="docblock"><p>Returns the number of non-leap-milliseconds since January 1, 1970 UTC.</p>
|
||
<h5 id="example-2"><a href="#example-2">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{Utc, NaiveDate};
|
||
|
||
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">1970</span>, <span class="number">1</span>, <span class="number">1</span>).unwrap().and_hms_milli_opt(<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">444</span>).unwrap().and_local_timezone(Utc).unwrap();
|
||
<span class="macro">assert_eq!</span>(dt.timestamp_millis(), <span class="number">1_444</span>);
|
||
|
||
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">2001</span>, <span class="number">9</span>, <span class="number">9</span>).unwrap().and_hms_milli_opt(<span class="number">1</span>, <span class="number">46</span>, <span class="number">40</span>, <span class="number">555</span>).unwrap().and_local_timezone(Utc).unwrap();
|
||
<span class="macro">assert_eq!</span>(dt.timestamp_millis(), <span class="number">1_000_000_000_555</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_micros" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#264-266">source</a><h4 class="code-header">pub fn <a href="#method.timestamp_micros" class="fn">timestamp_micros</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.i64.html">i64</a></h4></section></summary><div class="docblock"><p>Returns the number of non-leap-microseconds since January 1, 1970 UTC.</p>
|
||
<h5 id="example-3"><a href="#example-3">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{Utc, NaiveDate};
|
||
|
||
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">1970</span>, <span class="number">1</span>, <span class="number">1</span>).unwrap().and_hms_micro_opt(<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">444</span>).unwrap().and_local_timezone(Utc).unwrap();
|
||
<span class="macro">assert_eq!</span>(dt.timestamp_micros(), <span class="number">1_000_444</span>);
|
||
|
||
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">2001</span>, <span class="number">9</span>, <span class="number">9</span>).unwrap().and_hms_micro_opt(<span class="number">1</span>, <span class="number">46</span>, <span class="number">40</span>, <span class="number">555</span>).unwrap().and_local_timezone(Utc).unwrap();
|
||
<span class="macro">assert_eq!</span>(dt.timestamp_micros(), <span class="number">1_000_000_000_000_555</span>);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_nanos" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#280-283">source</a><h4 class="code-header">pub fn <a href="#method.timestamp_nanos" class="fn">timestamp_nanos</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.i64.html">i64</a></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.4.31: use <code>timestamp_nanos_opt()</code> instead</span></div></span></summary><div class="docblock"><p>Returns the number of non-leap-nanoseconds since January 1, 1970 UTC.</p>
|
||
<h5 id="panics-3"><a href="#panics-3">Panics</a></h5>
|
||
<p>An <code>i64</code> with nanosecond precision can span a range of ~584 years. This function panics on
|
||
an out of range <code>DateTime</code>.</p>
|
||
<p>The dates that can be represented as nanoseconds are between 1677-09-21T00:12:44.0 and
|
||
2262-04-11T23:47:16.854775804.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_nanos_opt" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#308-310">source</a><h4 class="code-header">pub fn <a href="#method.timestamp_nanos_opt" class="fn">timestamp_nanos_opt</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.i64.html">i64</a>></h4></section></summary><div class="docblock"><p>Returns the number of non-leap-nanoseconds since January 1, 1970 UTC.</p>
|
||
<h5 id="panics-4"><a href="#panics-4">Panics</a></h5>
|
||
<p>An <code>i64</code> with nanosecond precision can span a range of ~584 years. This function panics on
|
||
an out of range <code>DateTime</code>.</p>
|
||
<p>The dates that can be represented as nanoseconds are between 1677-09-21T00:12:44.0 and
|
||
2262-04-11T23:47:16.854775804.</p>
|
||
<h5 id="example-4"><a href="#example-4">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{Utc, NaiveDate};
|
||
|
||
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">1970</span>, <span class="number">1</span>, <span class="number">1</span>).unwrap().and_hms_nano_opt(<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">444</span>).unwrap().and_local_timezone(Utc).unwrap();
|
||
<span class="macro">assert_eq!</span>(dt.timestamp_nanos_opt(), <span class="prelude-val">Some</span>(<span class="number">1_000_000_444</span>));
|
||
|
||
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">2001</span>, <span class="number">9</span>, <span class="number">9</span>).unwrap().and_hms_nano_opt(<span class="number">1</span>, <span class="number">46</span>, <span class="number">40</span>, <span class="number">555</span>).unwrap().and_local_timezone(Utc).unwrap();
|
||
<span class="macro">assert_eq!</span>(dt.timestamp_nanos_opt(), <span class="prelude-val">Some</span>(<span class="number">1_000_000_000_000_000_555</span>));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_subsec_millis" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#317-319">source</a><h4 class="code-header">pub fn <a href="#method.timestamp_subsec_millis" class="fn">timestamp_subsec_millis</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Returns the number of milliseconds since the last second boundary.</p>
|
||
<p>In event of a leap second this may exceed 999.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_subsec_micros" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#326-328">source</a><h4 class="code-header">pub fn <a href="#method.timestamp_subsec_micros" class="fn">timestamp_subsec_micros</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Returns the number of microseconds since the last second boundary.</p>
|
||
<p>In event of a leap second this may exceed 999,999.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_subsec_nanos" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#335-337">source</a><h4 class="code-header">pub fn <a href="#method.timestamp_subsec_nanos" class="fn">timestamp_subsec_nanos</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Returns the number of nanoseconds since the last second boundary</p>
|
||
<p>In event of a leap second this may exceed 999,999,999.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.offset" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#342-344">source</a><h4 class="code-header">pub fn <a href="#method.offset" class="fn">offset</a>(&self) -> &Tz::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a></h4></section></summary><div class="docblock"><p>Retrieves an associated offset from UTC.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.timezone" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#349-351">source</a><h4 class="code-header">pub fn <a href="#method.timezone" class="fn">timezone</a>(&self) -> Tz</h4></section></summary><div class="docblock"><p>Retrieves an associated time zone.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_timezone" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#358-360">source</a><h4 class="code-header">pub fn <a href="#method.with_timezone" class="fn">with_timezone</a><Tz2: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>>(&self, tz: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&Tz2</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz2></h4></section></summary><div class="docblock"><p>Changes the associated time zone.
|
||
The returned <code>DateTime</code> references the same instant of time from the perspective of the
|
||
provided time zone.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.fixed_offset" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#366-368">source</a><h4 class="code-header">pub fn <a href="#method.fixed_offset" class="fn">fixed_offset</a>(&self) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>></h4></section></summary><div class="docblock"><p>Fix the offset from UTC to its current value, dropping the associated timezone information.
|
||
This it useful for converting a generic <code>DateTime<Tz: Timezone></code> to <code>DateTime<FixedOffset></code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_add_signed" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#377-381">source</a><h4 class="code-header">pub fn <a href="#method.checked_add_signed" class="fn">checked_add_signed</a>(self, rhs: <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">OldDuration</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Adds given <code>Duration</code> to the current date and time.</p>
|
||
<h5 id="errors"><a href="#errors">Errors</a></h5>
|
||
<p>Returns <code>None</code> if the resulting date would be out of range.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_add_months" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#396-401">source</a><h4 class="code-header">pub fn <a href="#method.checked_add_months" class="fn">checked_add_months</a>(self, rhs: <a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Adds given <code>Months</code> to the current date and time.</p>
|
||
<p>Uses the last day of the month if the day does not exist in the resulting month.</p>
|
||
<p>See <a href="naive/struct.NaiveDate.html#method.checked_add_months" title="method chrono::naive::NaiveDate::checked_add_months"><code>NaiveDate::checked_add_months</code></a> for more details on behavior.</p>
|
||
<h5 id="errors-1"><a href="#errors-1">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The resulting date would be out of range.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_sub_signed" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#410-414">source</a><h4 class="code-header">pub fn <a href="#method.checked_sub_signed" class="fn">checked_sub_signed</a>(self, rhs: <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">OldDuration</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Subtracts given <code>Duration</code> from the current date and time.</p>
|
||
<h5 id="errors-2"><a href="#errors-2">Errors</a></h5>
|
||
<p>Returns <code>None</code> if the resulting date would be out of range.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_sub_months" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#429-434">source</a><h4 class="code-header">pub fn <a href="#method.checked_sub_months" class="fn">checked_sub_months</a>(self, rhs: <a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Subtracts given <code>Months</code> from the current date and time.</p>
|
||
<p>Uses the last day of the month if the day does not exist in the resulting month.</p>
|
||
<p>See <a href="naive/struct.NaiveDate.html#method.checked_sub_months" title="method chrono::naive::NaiveDate::checked_sub_months"><code>NaiveDate::checked_sub_months</code></a> for more details on behavior.</p>
|
||
<h5 id="errors-3"><a href="#errors-3">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The resulting date would be out of range.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_add_days" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#445-450">source</a><h4 class="code-header">pub fn <a href="#method.checked_add_days" class="fn">checked_add_days</a>(self, days: <a class="struct" href="naive/struct.Days.html" title="struct chrono::naive::Days">Days</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></h4></section></summary><div class="docblock"><p>Add a duration in <a href="naive/struct.Days.html" title="struct chrono::naive::Days"><code>Days</code></a> to the date part of the <code>DateTime</code>.</p>
|
||
<h5 id="errors-4"><a href="#errors-4">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The resulting date would be out of range.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_sub_days" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#461-466">source</a><h4 class="code-header">pub fn <a href="#method.checked_sub_days" class="fn">checked_sub_days</a>(self, days: <a class="struct" href="naive/struct.Days.html" title="struct chrono::naive::Days">Days</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></h4></section></summary><div class="docblock"><p>Subtract a duration in <a href="naive/struct.Days.html" title="struct chrono::naive::Days"><code>Days</code></a> from the date part of the <code>DateTime</code>.</p>
|
||
<h5 id="errors-5"><a href="#errors-5">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The resulting date would be out of range.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.signed_duration_since" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#472-477">source</a><h4 class="code-header">pub fn <a href="#method.signed_duration_since" class="fn">signed_duration_since</a><Tz2: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>>(
|
||
self,
|
||
rhs: impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz2>>
|
||
) -> <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">OldDuration</a></h4></section></summary><div class="docblock"><p>Subtracts another <code>DateTime</code> from the current date and time.
|
||
This does not overflow or underflow at all.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.naive_utc" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#482-484">source</a><h4 class="code-header">pub fn <a href="#method.naive_utc" class="fn">naive_utc</a>(&self) -> <a class="struct" href="naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a></h4></section></summary><div class="docblock"><p>Returns a view to the naive UTC datetime.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.naive_local" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#495-497">source</a><h4 class="code-header">pub fn <a href="#method.naive_local" class="fn">naive_local</a>(&self) -> <a class="struct" href="naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a></h4></section></summary><div class="docblock"><p>Returns a view to the naive local datetime.</p>
|
||
<h5 id="panics-5"><a href="#panics-5">Panics</a></h5>
|
||
<p><a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a> internally stores the date and time in UTC with a <a href="naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime"><code>NaiveDateTime</code></a>. This
|
||
method will panic if the offset from UTC would push the local datetime outside of the
|
||
representable range of a <a href="naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime"><code>NaiveDateTime</code></a>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.years_since" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#505-519">source</a><h4 class="code-header">pub fn <a href="#method.years_since" class="fn">years_since</a>(&self, base: Self) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>></h4></section></summary><div class="docblock"><p>Retrieve the elapsed years from now to the given <a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a>.</p>
|
||
<h5 id="errors-6"><a href="#errors-6">Errors</a></h5>
|
||
<p>Returns <code>None</code> if <code>base < self</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_rfc2822" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#530-535">source</a><h4 class="code-header">pub fn <a href="#method.to_rfc2822" class="fn">to_rfc2822</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Returns an RFC 2822 date and time string such as <code>Tue, 1 Jul 2003 10:52:37 +0200</code>.</p>
|
||
<h5 id="panics-6"><a href="#panics-6">Panics</a></h5>
|
||
<p>Panics if the date can not be represented in this format: the year may not be negative and
|
||
can not have more than 4 digits.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_rfc3339" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#541-549">source</a><h4 class="code-header">pub fn <a href="#method.to_rfc3339" class="fn">to_rfc3339</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Returns an RFC 3339 and ISO 8601 date and time string such as <code>1996-12-19T16:39:57-08:00</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_rfc3339_opts" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#578-583">source</a><h4 class="code-header">pub fn <a href="#method.to_rfc3339_opts" class="fn">to_rfc3339_opts</a>(&self, secform: <a class="enum" href="enum.SecondsFormat.html" title="enum chrono::SecondsFormat">SecondsFormat</a>, use_z: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Return an RFC 3339 and ISO 8601 date and time string with subseconds
|
||
formatted as per <code>SecondsFormat</code>.</p>
|
||
<p>If <code>use_z</code> is true and the timezone is UTC (offset 0), uses <code>Z</code> as
|
||
per <a href="format/enum.Fixed.html#variant.TimezoneOffsetColonZ" title="variant chrono::format::Fixed::TimezoneOffsetColonZ"><code>Fixed::TimezoneOffsetColonZ</code></a>. If <code>use_z</code> is false, uses
|
||
<a href="format/enum.Fixed.html#variant.TimezoneOffsetColon" title="variant chrono::format::Fixed::TimezoneOffsetColon"><code>Fixed::TimezoneOffsetColon</code></a></p>
|
||
<h5 id="examples"><a href="#examples">Examples</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">2018</span>, <span class="number">1</span>, <span class="number">26</span>).unwrap().and_hms_micro_opt(<span class="number">18</span>, <span class="number">30</span>, <span class="number">9</span>, <span class="number">453_829</span>).unwrap().and_local_timezone(Utc).unwrap();
|
||
<span class="macro">assert_eq!</span>(dt.to_rfc3339_opts(SecondsFormat::Millis, <span class="bool-val">false</span>),
|
||
<span class="string">"2018-01-26T18:30:09.453+00:00"</span>);
|
||
<span class="macro">assert_eq!</span>(dt.to_rfc3339_opts(SecondsFormat::Millis, <span class="bool-val">true</span>),
|
||
<span class="string">"2018-01-26T18:30:09.453Z"</span>);
|
||
<span class="macro">assert_eq!</span>(dt.to_rfc3339_opts(SecondsFormat::Secs, <span class="bool-val">true</span>),
|
||
<span class="string">"2018-01-26T18:30:09Z"</span>);
|
||
|
||
<span class="kw">let </span>pst = FixedOffset::east_opt(<span class="number">8 </span>* <span class="number">60 </span>* <span class="number">60</span>).unwrap();
|
||
<span class="kw">let </span>dt = pst.from_local_datetime(<span class="kw-2">&</span>NaiveDate::from_ymd_opt(<span class="number">2018</span>, <span class="number">1</span>, <span class="number">26</span>).unwrap().and_hms_micro_opt(<span class="number">10</span>, <span class="number">30</span>, <span class="number">9</span>, <span class="number">453_829</span>).unwrap()).unwrap();
|
||
<span class="macro">assert_eq!</span>(dt.to_rfc3339_opts(SecondsFormat::Secs, <span class="bool-val">true</span>),
|
||
<span class="string">"2018-01-26T10:30:09+08:00"</span>);</code></pre></div>
|
||
</div></details><details class="toggle" open><summary><section id="associatedconstant.MIN_UTC" class="associatedconstant"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#586">source</a><h4 class="code-header">pub const <a href="#associatedconstant.MIN_UTC" class="constant">MIN_UTC</a>: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>> = _</h4></section></summary><div class="docblock"><p>The minimum possible <code>DateTime<Utc></code>.</p>
|
||
</div></details><details class="toggle" open><summary><section id="associatedconstant.MAX_UTC" class="associatedconstant"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#588">source</a><h4 class="code-header">pub const <a href="#associatedconstant.MAX_UTC" class="constant">MAX_UTC</a>: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>> = _</h4></section></summary><div class="docblock"><p>The maximum possible <code>DateTime<Utc></code>.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#591-629">source</a><a href="#impl-DateTime%3CUtc%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_timestamp" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#623-625">source</a><h4 class="code-header">pub fn <a href="#method.from_timestamp" class="fn">from_timestamp</a>(secs: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.i64.html">i64</a>, nsecs: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></h4></section></summary><div class="docblock"><p>Makes a new <a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime<Utc></code></a> 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.</p>
|
||
<p>This is guaranteed to round-trip with regard to <a href="struct.DateTime.html#method.timestamp" title="method chrono::DateTime::timestamp"><code>timestamp</code></a> and
|
||
<a href="struct.DateTime.html#method.timestamp_subsec_nanos" title="method chrono::DateTime::timestamp_subsec_nanos"><code>timestamp_subsec_nanos</code></a>.</p>
|
||
<p>If you need to create a <code>DateTime</code> with a <a href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone"><code>TimeZone</code></a> different from <a href="offset/struct.Utc.html" title="struct chrono::offset::Utc"><code>Utc</code></a>, use
|
||
<a href="offset/trait.TimeZone.html#method.timestamp_opt" title="method chrono::offset::TimeZone::timestamp_opt"><code>TimeZone::timestamp_opt</code></a> or <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>.</p>
|
||
<p>The nanosecond part can exceed 1,000,000,000 in order to represent a
|
||
<a href="naive/struct.NaiveTime.html#leap-second-handling" title="struct chrono::naive::NaiveTime">leap second</a>, but only when <code>secs % 60 == 59</code>.
|
||
(The true “UNIX timestamp” cannot represent a leap second unambiguously.)</p>
|
||
<h5 id="errors-7"><a href="#errors-7">Errors</a></h5>
|
||
<p>Returns <code>None</code> on out-of-range number of seconds and/or
|
||
invalid nanosecond, otherwise returns <code>Some(DateTime {...})</code>.</p>
|
||
<h5 id="example-5"><a href="#example-5">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{DateTime, Utc};
|
||
|
||
<span class="kw">let </span>dt: DateTime<Utc> = DateTime::<Utc>::from_timestamp(<span class="number">1431648000</span>, <span class="number">0</span>).expect(<span class="string">"invalid timestamp"</span>);
|
||
|
||
<span class="macro">assert_eq!</span>(dt.to_string(), <span class="string">"2015-05-15 00:00:00 UTC"</span>);
|
||
<span class="macro">assert_eq!</span>(DateTime::from_timestamp(dt.timestamp(), dt.timestamp_subsec_nanos()).unwrap(), dt);</code></pre></div>
|
||
</div></details><details class="toggle" open><summary><section id="associatedconstant.UNIX_EPOCH" class="associatedconstant"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#628">source</a><h4 class="code-header">pub const <a href="#associatedconstant.UNIX_EPOCH" class="constant">UNIX_EPOCH</a>: Self = _</h4></section></summary><div class="docblock"><p>The Unix Epoch, 1970-01-01 00:00:00 UTC.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-DateTime%3CFixedOffset%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#731-851">source</a><a href="#impl-DateTime%3CFixedOffset%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.parse_from_rfc2822" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#764-769">source</a><h4 class="code-header">pub fn <a href="#method.parse_from_rfc2822" class="fn">parse_from_rfc2822</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>>></h4></section></summary><div class="docblock"><p>Parses an RFC 2822 date-and-time string into a <code>DateTime<FixedOffset></code> value.</p>
|
||
<p>This parses valid RFC 2822 datetime strings (such as <code>Tue, 1 Jul 2003 10:52:37 +0200</code>)
|
||
and returns a new <a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a> instance with the parsed timezone as the <a href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset"><code>FixedOffset</code></a>.</p>
|
||
<p>RFC 2822 is the internet message standard that specifies the representation of times in HTTP
|
||
and email headers. It is the 2001 revision of RFC 822, and is itself revised as RFC 5322 in
|
||
2008.</p>
|
||
<h5 id="support-for-the-obsolete-date-format"><a href="#support-for-the-obsolete-date-format">Support for the obsolete date format</a></h5>
|
||
<ul>
|
||
<li>A 2-digit year is interpreted to be a year in 1950-2049.</li>
|
||
<li>The standard allows comments and whitespace between many of the tokens. See <a href="https://www.rfc-editor.org/rfc/rfc2822#section-4.3">4.3</a> and
|
||
<a href="https://www.rfc-editor.org/rfc/rfc2822#appendix-A.5">Appendix A.5</a></li>
|
||
<li>Single letter ‘military’ time zone names are parsed as a <code>-0000</code> offset.
|
||
They were defined with the wrong sign in RFC 822 and corrected in RFC 2822. But because
|
||
the meaning is now ambiguous, the standard says they should be be considered as <code>-0000</code>
|
||
unless there is out-of-band information confirming their meaning.
|
||
The exception is <code>Z</code>, which remains identical to <code>+0000</code>.</li>
|
||
</ul>
|
||
<h5 id="example-6"><a href="#example-6">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(
|
||
DateTime::parse_from_rfc2822(<span class="string">"Wed, 18 Feb 2015 23:16:09 GMT"</span>).unwrap(),
|
||
FixedOffset::east_opt(<span class="number">0</span>).unwrap().with_ymd_and_hms(<span class="number">2015</span>, <span class="number">2</span>, <span class="number">18</span>, <span class="number">23</span>, <span class="number">16</span>, <span class="number">9</span>).unwrap()
|
||
);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_from_rfc3339" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#784-791">source</a><h4 class="code-header">pub fn <a href="#method.parse_from_rfc3339" class="fn">parse_from_rfc3339</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>>></h4></section></summary><div class="docblock"><p>Parses an RFC 3339 date-and-time string into a <code>DateTime<FixedOffset></code> value.</p>
|
||
<p>Parses all valid RFC 3339 values (as well as the subset of valid ISO 8601 values that are
|
||
also valid RFC 3339 date-and-time values) and returns a new <a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a> with a
|
||
<a href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset"><code>FixedOffset</code></a> corresponding to the parsed timezone. While RFC 3339 values come in a wide
|
||
variety of shapes and sizes, <code>1996-12-19T16:39:57-08:00</code> is an example of the most commonly
|
||
encountered variety of RFC 3339 formats.</p>
|
||
<p>Why isn’t this named <code>parse_from_iso8601</code>? That’s because ISO 8601 allows representing
|
||
values in a wide range of formats, only some of which represent actual date-and-time
|
||
instances (rather than periods, ranges, dates, or times). Some valid ISO 8601 values are
|
||
also simultaneously valid RFC 3339 values, but not all RFC 3339 values are valid ISO 8601
|
||
values (or the other way around).</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_from_str" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#812-816">source</a><h4 class="code-header">pub fn <a href="#method.parse_from_str" class="fn">parse_from_str</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>, fmt: &<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>>></h4></section></summary><div class="docblock"><p>Parses a string from a user-specified format into a <code>DateTime<FixedOffset></code> value.</p>
|
||
<p>Note that this method <em>requires a timezone</em> in the input string. See
|
||
<a href="./naive/struct.NaiveDateTime.html#method.parse_from_str"><code>NaiveDateTime::parse_from_str</code></a>
|
||
for a version that does not require a timezone in the to-be-parsed str. The returned
|
||
<a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a> value will have a <a href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset"><code>FixedOffset</code></a> reflecting the parsed timezone.</p>
|
||
<p>See the <a href="./format/strftime/index.html"><code>format::strftime</code> module</a> for supported format
|
||
sequences.</p>
|
||
<h5 id="example-7"><a href="#example-7">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{DateTime, FixedOffset, TimeZone, NaiveDate};
|
||
|
||
<span class="kw">let </span>dt = DateTime::parse_from_str(
|
||
<span class="string">"1983 Apr 13 12:09:14.274 +0000"</span>, <span class="string">"%Y %b %d %H:%M:%S%.3f %z"</span>);
|
||
<span class="macro">assert_eq!</span>(dt, <span class="prelude-val">Ok</span>(FixedOffset::east_opt(<span class="number">0</span>).unwrap().from_local_datetime(<span class="kw-2">&</span>NaiveDate::from_ymd_opt(<span class="number">1983</span>, <span class="number">4</span>, <span class="number">13</span>).unwrap().and_hms_milli_opt(<span class="number">12</span>, <span class="number">9</span>, <span class="number">14</span>, <span class="number">274</span>).unwrap()).unwrap()));</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_and_remainder" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#843-850">source</a><h4 class="code-header">pub fn <a href="#method.parse_and_remainder" class="fn">parse_and_remainder</a><'a>(
|
||
s: &'a <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>,
|
||
fmt: &<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>
|
||
) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><(<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>>, &'a <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>)></h4></section></summary><div class="docblock"><p>Parses a string from a user-specified format into a <code>DateTime<FixedOffset></code> value, and a
|
||
slice with the remaining portion of the string.</p>
|
||
<p>Note that this method <em>requires a timezone</em> in the input string. See
|
||
<a href="naive/struct.NaiveDateTime.html#method.parse_and_remainder" title="associated function chrono::naive::NaiveDateTime::parse_and_remainder"><code>NaiveDateTime::parse_and_remainder</code></a> for a version that does not
|
||
require a timezone in <code>s</code>. The returned <a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a> value will have a <a href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset"><code>FixedOffset</code></a>
|
||
reflecting the parsed timezone.</p>
|
||
<p>See the <a href="./format/strftime/index.html"><code>format::strftime</code> module</a> for supported format
|
||
sequences.</p>
|
||
<p>Similar to <a href="#method.parse_from_str"><code>parse_from_str</code></a>.</p>
|
||
<h5 id="example-8"><a href="#example-8">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>(datetime, remainder) = DateTime::parse_and_remainder(
|
||
<span class="string">"2015-02-18 23:16:09 +0200 trailing text"</span>, <span class="string">"%Y-%m-%d %H:%M:%S %z"</span>).unwrap();
|
||
<span class="macro">assert_eq!</span>(
|
||
datetime,
|
||
FixedOffset::east_opt(<span class="number">2</span><span class="kw-2">*</span><span class="number">3600</span>).unwrap().with_ymd_and_hms(<span class="number">2015</span>, <span class="number">2</span>, <span class="number">18</span>, <span class="number">23</span>, <span class="number">16</span>, <span class="number">9</span>).unwrap()
|
||
);
|
||
<span class="macro">assert_eq!</span>(remainder, <span class="string">" trailing text"</span>);</code></pre></div>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-DateTime%3CTz%3E-1" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#853-931">source</a><a href="#impl-DateTime%3CTz%3E-1" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
|
||
Tz::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.format_with_items" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#862-869">source</a><h4 class="code-header">pub fn <a href="#method.format_with_items" class="fn">format_with_items</a><'a, I, B>(&self, items: I) -> <a class="struct" href="format/struct.DelayedFormat.html" title="struct chrono::format::DelayedFormat">DelayedFormat</a><I><div class="where">where
|
||
I: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = B> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
|
||
B: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><<a class="enum" href="format/enum.Item.html" title="enum chrono::format::Item">Item</a><'a>>,</div></h4></section></summary><div class="docblock"><p>Formats the combined date and time with the specified formatting items.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.format" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#887-889">source</a><h4 class="code-header">pub fn <a href="#method.format" class="fn">format</a><'a>(&self, fmt: &'a <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -> <a class="struct" href="format/struct.DelayedFormat.html" title="struct chrono::format::DelayedFormat">DelayedFormat</a><<a class="struct" href="format/strftime/struct.StrftimeItems.html" title="struct chrono::format::strftime::StrftimeItems">StrftimeItems</a><'a>></h4></section></summary><div class="docblock"><p>Formats the combined date and time per the specified format string.</p>
|
||
<p>See the <a href="format/strftime/index.html" title="mod chrono::format::strftime"><code>crate::format::strftime</code></a> module for the supported escape sequences.</p>
|
||
<h5 id="example-9"><a href="#example-9">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>date_time: DateTime<Utc> = Utc.with_ymd_and_hms(<span class="number">2017</span>, <span class="number">04</span>, <span class="number">02</span>, <span class="number">12</span>, <span class="number">50</span>, <span class="number">32</span>).unwrap();
|
||
<span class="kw">let </span>formatted = <span class="macro">format!</span>(<span class="string">"{}"</span>, date_time.format(<span class="string">"%d/%m/%Y %H:%M"</span>));
|
||
<span class="macro">assert_eq!</span>(formatted, <span class="string">"02/04/2017 12:50"</span>);</code></pre></div>
|
||
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Add%3CDays%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1323-1329">source</a><a href="#impl-Add%3CDays%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><<a class="struct" href="naive/struct.Days.html" title="struct chrono::naive::Days">Days</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-10" class="associatedtype trait-impl"><a href="#associatedtype.Output-10" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>+</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.add-3" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1326-1328">source</a><a href="#method.add-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#tymethod.add" class="fn">add</a>(self, days: <a class="struct" href="naive/struct.Days.html" title="struct chrono::naive::Days">Days</a>) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#associatedtype.Output" title="type core::ops::arith::Add::Output">Output</a></h4></section></summary><div class='docblock'>Performs the <code>+</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#tymethod.add">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Add%3CDuration%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1220-1229">source</a><a href="#impl-Add%3CDuration%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><<a class="struct" href="https://doc.rust-lang.org/1.76.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-9" class="associatedtype trait-impl"><a href="#associatedtype.Output-9" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>+</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.add-2" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1224-1228">source</a><a href="#method.add-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#tymethod.add" class="fn">add</a>(self, rhs: <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Performs the <code>+</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#tymethod.add">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Add%3CDuration%3E-for-DateTime%3CTz%3E-1" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1211-1218">source</a><a href="#impl-Add%3CDuration%3E-for-DateTime%3CTz%3E-1" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><<a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-11" class="associatedtype trait-impl"><a href="#associatedtype.Output-11" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>+</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.add-4" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1215-1217">source</a><a href="#method.add-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#tymethod.add" class="fn">add</a>(self, rhs: <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">OldDuration</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Performs the <code>+</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#tymethod.add">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Add%3CFixedOffset%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/offset/fixed.rs.html#237-244">source</a><a href="#impl-Add%3CFixedOffset%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-6" class="associatedtype trait-impl"><a href="#associatedtype.Output-6" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>+</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.add-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/offset/fixed.rs.html#241-243">source</a><a href="#method.add-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#tymethod.add" class="fn">add</a>(self, rhs: <a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Performs the <code>+</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#tymethod.add">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Add%3CMonths%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1250-1256">source</a><a href="#impl-Add%3CMonths%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><<a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-5" class="associatedtype trait-impl"><a href="#associatedtype.Output-5" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>+</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.add" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1253-1255">source</a><a href="#method.add" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#tymethod.add" class="fn">add</a>(self, rhs: <a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#associatedtype.Output" title="type core::ops::arith::Add::Output">Output</a></h4></section></summary><div class='docblock'>Performs the <code>+</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html#tymethod.add">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1241-1248">source</a><a href="#impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.AddAssign.html" title="trait core::ops::arith::AddAssign">AddAssign</a><<a class="struct" href="https://doc.rust-lang.org/1.76.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.add_assign" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1243-1247">source</a><a href="#method.add_assign" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.AddAssign.html#tymethod.add_assign" class="fn">add_assign</a>(&mut self, rhs: <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>)</h4></section></summary><div class='docblock'>Performs the <code>+=</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.AddAssign.html#tymethod.add_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E-1" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1231-1239">source</a><a href="#impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E-1" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.AddAssign.html" title="trait core::ops::arith::AddAssign">AddAssign</a><<a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.add_assign-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1233-1238">source</a><a href="#method.add_assign-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.AddAssign.html#tymethod.add_assign" class="fn">add_assign</a>(&mut self, rhs: <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">OldDuration</a>)</h4></section></summary><div class='docblock'>Performs the <code>+=</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.AddAssign.html#tymethod.add_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#84">source</a><a href="#impl-Clone-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
|
||
Tz::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#84">source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&self) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.76.0/src/core/clone.rs.html#169">source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&Self</a>)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Datelike-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#933-1082">source</a><a href="#impl-Datelike-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="trait.Datelike.html" title="trait chrono::Datelike">Datelike</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_year" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#983-985">source</a><a href="#method.with_year" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_year" class="fn">with_year</a>(&self, year: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.i32.html">i32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the year number changed, while keeping the same month and day.</p>
|
||
<p>See also the <a href="naive/struct.NaiveDate.html#method.with_year" title="method chrono::naive::NaiveDate::with_year"><code>NaiveDate::with_year</code></a> method.</p>
|
||
<h5 id="errors-8"><a href="#errors-8">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The resulting date does not exist.</li>
|
||
<li>When the <code>NaiveDateTime</code> would be out of range.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_month" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#999-1001">source</a><a href="#method.with_month" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_month" class="fn">with_month</a>(&self, month: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the month number (starting from 1) changed.</p>
|
||
<p>See also the <a href="naive/struct.NaiveDate.html#method.with_month" title="method chrono::naive::NaiveDate::with_month"><code>NaiveDate::with_month</code></a> method.</p>
|
||
<h5 id="errors-9"><a href="#errors-9">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The resulting date does not exist.</li>
|
||
<li>The value for <code>month</code> is invalid.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_month0" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1015-1017">source</a><a href="#method.with_month0" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_month0" class="fn">with_month0</a>(&self, month0: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the month number (starting from 0) changed.</p>
|
||
<p>See also the <a href="naive/struct.NaiveDate.html#method.with_month0" title="method chrono::naive::NaiveDate::with_month0"><code>NaiveDate::with_month0</code></a> method.</p>
|
||
<h5 id="errors-10"><a href="#errors-10">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The resulting date does not exist.</li>
|
||
<li>The value for <code>month0</code> is invalid.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_day" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1031-1033">source</a><a href="#method.with_day" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_day" class="fn">with_day</a>(&self, day: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the month number (starting from 0) changed.</p>
|
||
<p>See also the <a href="naive/struct.NaiveDate.html#method.with_day" title="method chrono::naive::NaiveDate::with_day"><code>NaiveDate::with_day</code></a> method.</p>
|
||
<h5 id="errors-11"><a href="#errors-11">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The resulting date does not exist.</li>
|
||
<li>The value for <code>day</code> is invalid.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_day0" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1047-1049">source</a><a href="#method.with_day0" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_day0" class="fn">with_day0</a>(&self, day0: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the month number (starting from 0) changed.</p>
|
||
<p>See also the <a href="naive/struct.NaiveDate.html#method.with_day0" title="method chrono::naive::NaiveDate::with_day0"><code>NaiveDate::with_day0</code></a> method.</p>
|
||
<h5 id="errors-12"><a href="#errors-12">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The resulting date does not exist.</li>
|
||
<li>The value for <code>day0</code> is invalid.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_ordinal" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1063-1065">source</a><a href="#method.with_ordinal" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_ordinal" class="fn">with_ordinal</a>(&self, ordinal: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the month number (starting from 0) changed.</p>
|
||
<p>See also the <a href="naive/struct.NaiveDate.html#method.with_ordinal" title="method chrono::naive::NaiveDate::with_ordinal"><code>NaiveDate::with_ordinal</code></a> method.</p>
|
||
<h5 id="errors-13"><a href="#errors-13">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The resulting date does not exist.</li>
|
||
<li>The value for <code>ordinal</code> is invalid.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_ordinal0" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1079-1081">source</a><a href="#method.with_ordinal0" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_ordinal0" class="fn">with_ordinal0</a>(&self, ordinal0: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the month number (starting from 0) changed.</p>
|
||
<p>See also the <a href="naive/struct.NaiveDate.html#method.with_ordinal0" title="method chrono::naive::NaiveDate::with_ordinal0"><code>NaiveDate::with_ordinal0</code></a> method.</p>
|
||
<h5 id="errors-14"><a href="#errors-14">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The resulting date does not exist.</li>
|
||
<li>The value for <code>ordinal0</code> is invalid.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.year" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#935-937">source</a><a href="#method.year" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.year" class="fn">year</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.i32.html">i32</a></h4></section></summary><div class='docblock'>Returns the year number in the <a href="./naive/struct.NaiveDate.html#calendar-date">calendar date</a>.</div></details><details class="toggle method-toggle" open><summary><section id="method.month" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#939-941">source</a><a href="#method.month" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.month" class="fn">month</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the month number starting from 1. <a href="trait.Datelike.html#tymethod.month">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.month0" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#943-945">source</a><a href="#method.month0" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.month0" class="fn">month0</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the month number starting from 0. <a href="trait.Datelike.html#tymethod.month0">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.day" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#947-949">source</a><a href="#method.day" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.day" class="fn">day</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the day of month starting from 1. <a href="trait.Datelike.html#tymethod.day">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.day0" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#951-953">source</a><a href="#method.day0" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.day0" class="fn">day0</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the day of month starting from 0. <a href="trait.Datelike.html#tymethod.day0">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ordinal" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#955-957">source</a><a href="#method.ordinal" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.ordinal" class="fn">ordinal</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the day of year starting from 1. <a href="trait.Datelike.html#tymethod.ordinal">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ordinal0" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#959-961">source</a><a href="#method.ordinal0" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.ordinal0" class="fn">ordinal0</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the day of year starting from 0. <a href="trait.Datelike.html#tymethod.ordinal0">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.weekday" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#963-965">source</a><a href="#method.weekday" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.weekday" class="fn">weekday</a>(&self) -> <a class="enum" href="enum.Weekday.html" title="enum chrono::Weekday">Weekday</a></h4></section></summary><div class='docblock'>Returns the day of week.</div></details><details class="toggle method-toggle" open><summary><section id="method.iso_week" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#967-969">source</a><a href="#method.iso_week" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.iso_week" class="fn">iso_week</a>(&self) -> <a class="struct" href="naive/struct.IsoWeek.html" title="struct chrono::naive::IsoWeek">IsoWeek</a></h4></section></summary><div class='docblock'>Returns the ISO week.</div></details><details class="toggle method-toggle" open><summary><section id="method.year_ce" class="method trait-impl"><a class="src rightside" href="../src/chrono/traits.rs.html#38-45">source</a><a href="#method.year_ce" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#method.year_ce" class="fn">year_ce</a>(&self) -> (<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>)</h4></section></summary><div class='docblock'>Returns the absolute year number starting from 1 with a boolean flag,
|
||
which is false when the year predates the epoch (BCE/BC) and true otherwise (CE/AD).</div></details><details class="toggle method-toggle" open><summary><section id="method.num_days_from_ce" class="method trait-impl"><a class="src rightside" href="../src/chrono/traits.rs.html#248-263">source</a><a href="#method.num_days_from_ce" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#method.num_days_from_ce" class="fn">num_days_from_ce</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.i32.html">i32</a></h4></section></summary><div class='docblock'>Counts the days in the proleptic Gregorian calendar, with January 1, Year 1 (CE) as day 1. <a href="trait.Datelike.html#method.num_days_from_ce">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1339-1344">source</a><a href="#impl-Debug-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1340-1343">source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.76.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-DateTime%3CFixedOffset%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#645-649">source</a><a href="#impl-Default-for-DateTime%3CFixedOffset%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#646-648">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-DateTime%3CLocal%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#639-643">source</a><a href="#impl-Default-for-DateTime%3CLocal%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#640-642">source</a><a href="#method.default-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#631-635">source</a><a href="#impl-Default-for-DateTime%3CUtc%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default-2" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#632-634">source</a><a href="#method.default-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.76.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Deserialize%3C'de%3E-for-DateTime%3CFixedOffset%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#78-85">source</a><a href="#impl-Deserialize%3C'de%3E-for-DateTime%3CFixedOffset%3E" class="anchor">§</a><h3 class="code-header">impl<'de> <a class="trait" href="../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a><'de> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>></h3></section></summary><div class="docblock"><p>Deserialize a value that optionally includes a timezone offset in its
|
||
string representation</p>
|
||
<p>The value to be deserialized must be an rfc3339 string.</p>
|
||
<p>See <a href="./serde/index.html">the <code>serde</code> module</a> for alternate
|
||
deserialization formats.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.deserialize-2" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#79-84">source</a><a href="#method.deserialize-2" class="anchor">§</a><h4 class="code-header">fn <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize" class="fn">deserialize</a><D>(deserializer: D) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, D::<a class="associatedtype" href="../serde/de/trait.Deserializer.html#associatedtype.Error" title="type serde::de::Deserializer::Error">Error</a>><div class="where">where
|
||
D: <a class="trait" href="../serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a><'de>,</div></h4></section></summary><div class='docblock'>Deserialize this value from the given Serde deserializer. <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Deserialize%3C'de%3E-for-DateTime%3CLocal%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#111-118">source</a><a href="#impl-Deserialize%3C'de%3E-for-DateTime%3CLocal%3E" class="anchor">§</a><h3 class="code-header">impl<'de> <a class="trait" href="../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a><'de> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>></h3></section></summary><div class="docblock"><p>Deserialize a value that includes no timezone in its string
|
||
representation</p>
|
||
<p>The value to be deserialized must be an rfc3339 string.</p>
|
||
<p>See <a href="./serde/index.html">the <code>serde</code> module</a> for alternate
|
||
serialization formats.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.deserialize" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#112-117">source</a><a href="#method.deserialize" class="anchor">§</a><h4 class="code-header">fn <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize" class="fn">deserialize</a><D>(deserializer: D) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, D::<a class="associatedtype" href="../serde/de/trait.Deserializer.html#associatedtype.Error" title="type serde::de::Deserializer::Error">Error</a>><div class="where">where
|
||
D: <a class="trait" href="../serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a><'de>,</div></h4></section></summary><div class='docblock'>Deserialize this value from the given Serde deserializer. <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Deserialize%3C'de%3E-for-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#93-100">source</a><a href="#impl-Deserialize%3C'de%3E-for-DateTime%3CUtc%3E" class="anchor">§</a><h3 class="code-header">impl<'de> <a class="trait" href="../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a><'de> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>></h3></section></summary><div class="docblock"><p>Deserialize into a UTC value</p>
|
||
<p>The value to be deserialized must be an rfc3339 string.</p>
|
||
<p>See <a href="./serde/index.html">the <code>serde</code> module</a> for alternate
|
||
deserialization formats.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.deserialize-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#94-99">source</a><a href="#method.deserialize-1" class="anchor">§</a><h4 class="code-header">fn <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize" class="fn">deserialize</a><D>(deserializer: D) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, D::<a class="associatedtype" href="../serde/de/trait.Deserializer.html#associatedtype.Error" title="type serde::de::Deserializer::Error">Error</a>><div class="where">where
|
||
D: <a class="trait" href="../serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a><'de>,</div></h4></section></summary><div class='docblock'>Deserialize this value from the given Serde deserializer. <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Display-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1346-1355">source</a><a href="#impl-Display-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
|
||
Tz::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1350-1354">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Display.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.76.0/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-DurationRound-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/round.rs.html#145-155">source</a><a href="#impl-DurationRound-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="trait.DurationRound.html" title="trait chrono::DurationRound">DurationRound</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Err-2" class="associatedtype trait-impl"><a href="#associatedtype.Err-2" class="anchor">§</a><h4 class="code-header">type <a href="trait.DurationRound.html#associatedtype.Err" class="associatedtype">Err</a> = <a class="enum" href="enum.RoundingError.html" title="enum chrono::RoundingError">RoundingError</a></h4></section></summary><div class='docblock'>Error that can occur in rounding or truncating</div></details><details class="toggle method-toggle" open><summary><section id="method.duration_round" class="method trait-impl"><a class="src rightside" href="../src/chrono/round.rs.html#148-150">source</a><a href="#method.duration_round" class="anchor">§</a><h4 class="code-header">fn <a href="trait.DurationRound.html#tymethod.duration_round" class="fn">duration_round</a>(self, duration: <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, Self::<a class="associatedtype" href="trait.DurationRound.html#associatedtype.Err" title="type chrono::DurationRound::Err">Err</a>></h4></section></summary><div class='docblock'>Return a copy rounded by Duration. <a href="trait.DurationRound.html#tymethod.duration_round">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.duration_trunc" class="method trait-impl"><a class="src rightside" href="../src/chrono/round.rs.html#152-154">source</a><a href="#method.duration_trunc" class="anchor">§</a><h4 class="code-header">fn <a href="trait.DurationRound.html#tymethod.duration_trunc" class="fn">duration_trunc</a>(self, duration: <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, Self::<a class="associatedtype" href="trait.DurationRound.html#associatedtype.Err" title="type chrono::DurationRound::Err">Err</a>></h4></section></summary><div class='docblock'>Return a copy truncated by Duration. <a href="trait.DurationRound.html#tymethod.duration_trunc">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CFixedOffset%3E%3E-for-DateTime%3CLocal%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#688-696">source</a><a href="#impl-From%3CDateTime%3CFixedOffset%3E%3E-for-DateTime%3CLocal%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>></h3></section></summary><div class="docblock"><p>Convert a <code>DateTime<FixedOffset></code> instance into a <code>DateTime<Local></code> instance.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-4" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#693-695">source</a><a href="#method.from-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>>) -> Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime<FixedOffset></code> instance into a <code>DateTime<Local></code> instance.</p>
|
||
<p>Conversion is performed via <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>. Returns the equivalent value in local
|
||
time.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CFixedOffset%3E%3E-for-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#675-683">source</a><a href="#impl-From%3CDateTime%3CFixedOffset%3E%3E-for-DateTime%3CUtc%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>></h3></section></summary><div class="docblock"><p>Convert a <code>DateTime<FixedOffset></code> instance into a <code>DateTime<Utc></code> instance.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-8" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#680-682">source</a><a href="#method.from-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>>) -> Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime<FixedOffset></code> instance into a <code>DateTime<Utc></code> instance.</p>
|
||
<p>Conversion is performed via <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>, accounting for the timezone
|
||
difference.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CLocal%3E%3E-for-DateTime%3CFixedOffset%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#714-721">source</a><a href="#impl-From%3CDateTime%3CLocal%3E%3E-for-DateTime%3CFixedOffset%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>></h3></section></summary><div class="docblock"><p>Convert a <code>DateTime<Local></code> instance into a <code>DateTime<FixedOffset></code> instance.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-5" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#718-720">source</a><a href="#method.from-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>>) -> Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime<Local></code> instance into a <code>DateTime<FixedOffset></code> instance.</p>
|
||
<p>Conversion is performed via <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CLocal%3E%3E-for-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#701-709">source</a><a href="#impl-From%3CDateTime%3CLocal%3E%3E-for-DateTime%3CUtc%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>></h3></section></summary><div class="docblock"><p>Convert a <code>DateTime<Local></code> instance into a <code>DateTime<Utc></code> instance.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-6" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#706-708">source</a><a href="#method.from-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>>) -> Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime<Local></code> instance into a <code>DateTime<Utc></code> instance.</p>
|
||
<p>Conversion is performed via <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>, accounting for the difference in
|
||
timezones.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CTz%3E%3E-for-SystemTime" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1432-1443">source</a><a href="#impl-From%3CDateTime%3CTz%3E%3E-for-SystemTime" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>> for <a class="struct" href="https://doc.rust-lang.org/1.76.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1433-1442">source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(dt: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>) -> <a class="struct" href="https://doc.rust-lang.org/1.76.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CUtc%3E%3E-for-DateTime%3CFixedOffset%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#652-660">source</a><a href="#impl-From%3CDateTime%3CUtc%3E%3E-for-DateTime%3CFixedOffset%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>></h3></section></summary><div class="docblock"><p>Convert a <code>DateTime<Utc></code> instance into a <code>DateTime<FixedOffset></code> instance.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-3" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#657-659">source</a><a href="#method.from-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>>) -> Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime<Utc></code> instance into a <code>DateTime<FixedOffset></code> instance.</p>
|
||
<p>Conversion is done via <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>. Note that the converted value returned by
|
||
this will be created with a fixed timezone offset of 0.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CUtc%3E%3E-for-DateTime%3CLocal%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#665-672">source</a><a href="#impl-From%3CDateTime%3CUtc%3E%3E-for-DateTime%3CLocal%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>></h3></section></summary><div class="docblock"><p>Convert a <code>DateTime<Utc></code> instance into a <code>DateTime<Local></code> instance.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-2" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#669-671">source</a><a href="#method.from-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>>) -> Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime<Utc></code> instance into a <code>DateTime<Local></code> instance.</p>
|
||
<p>Conversion is performed via <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>, accounting for the difference in timezones.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CSystemTime%3E-for-DateTime%3CLocal%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1424-1428">source</a><a href="#impl-From%3CSystemTime%3E-for-DateTime%3CLocal%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.76.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-7" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1425-1427">source</a><a href="#method.from-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: <a class="struct" href="https://doc.rust-lang.org/1.76.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CSystemTime%3E-for-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1403-1420">source</a><a href="#impl-From%3CSystemTime%3E-for-DateTime%3CUtc%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.76.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1404-1419">source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: <a class="struct" href="https://doc.rust-lang.org/1.76.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromStr-for-DateTime%3CFixedOffset%3E" class="impl"><a class="src rightside" href="../src/chrono/format/parse.rs.html#527-538">source</a><a href="#impl-FromStr-for-DateTime%3CFixedOffset%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html" title="trait core::str::traits::FromStr">FromStr</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>></h3></section></summary><div class="docblock"><p>Accepts a relaxed form of RFC3339.
|
||
A space or a ‘T’ are acepted as the separator between the date and time
|
||
parts. Additional spaces are allowed between each component.</p>
|
||
<p>All of these examples are equivalent:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="string">"2012-12-12T12:12:12Z"</span>.parse::<DateTime<FixedOffset>>()<span class="question-mark">?</span>;
|
||
<span class="string">"2012-12-12 12:12:12Z"</span>.parse::<DateTime<FixedOffset>>()<span class="question-mark">?</span>;
|
||
<span class="string">"2012- 12-12T12: 12:12Z"</span>.parse::<DateTime<FixedOffset>>()<span class="question-mark">?</span>;</code></pre></div>
|
||
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Err-1" class="associatedtype trait-impl"><a href="#associatedtype.Err-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html#associatedtype.Err" class="associatedtype">Err</a> = <a class="struct" href="format/struct.ParseError.html" title="struct chrono::format::ParseError">ParseError</a></h4></section></summary><div class='docblock'>The associated error which can be returned from parsing.</div></details><details class="toggle method-toggle" open><summary><section id="method.from_str-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/format/parse.rs.html#530-537">source</a><a href="#method.from_str-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html#tymethod.from_str" class="fn">from_str</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>>></h4></section></summary><div class='docblock'>Parses a string <code>s</code> to return a value of this type. <a href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html#tymethod.from_str">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromStr-for-DateTime%3CLocal%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1393-1399">source</a><a href="#impl-FromStr-for-DateTime%3CLocal%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html" title="trait core::str::traits::FromStr">FromStr</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>></h3></section></summary><div class="docblock"><p>Accepts a relaxed form of RFC3339.
|
||
A space or a ‘T’ are accepted as the separator between the date and time
|
||
parts.</p>
|
||
<p>All of these examples are equivalent:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="string">"2012-12-12T12:12:12Z"</span>.parse::<DateTime<Local>>()<span class="question-mark">?</span>;
|
||
<span class="string">"2012-12-12 12:12:12Z"</span>.parse::<DateTime<Local>>()<span class="question-mark">?</span>;
|
||
<span class="string">"2012-12-12 12:12:12+0000"</span>.parse::<DateTime<Local>>()<span class="question-mark">?</span>;
|
||
<span class="string">"2012-12-12 12:12:12+00:00"</span>.parse::<DateTime<Local>>()<span class="question-mark">?</span>;</code></pre></div>
|
||
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Err" class="associatedtype trait-impl"><a href="#associatedtype.Err" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html#associatedtype.Err" class="associatedtype">Err</a> = <a class="struct" href="format/struct.ParseError.html" title="struct chrono::format::ParseError">ParseError</a></h4></section></summary><div class='docblock'>The associated error which can be returned from parsing.</div></details><details class="toggle method-toggle" open><summary><section id="method.from_str" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1396-1398">source</a><a href="#method.from_str" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html#tymethod.from_str" class="fn">from_str</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>>></h4></section></summary><div class='docblock'>Parses a string <code>s</code> to return a value of this type. <a href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html#tymethod.from_str">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromStr-for-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1370-1376">source</a><a href="#impl-FromStr-for-DateTime%3CUtc%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html" title="trait core::str::traits::FromStr">FromStr</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>></h3></section></summary><div class="docblock"><p>Accepts a relaxed form of RFC3339.
|
||
A space or a ‘T’ are accepted as the separator between the date and time
|
||
parts.</p>
|
||
<p>All of these examples are equivalent:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="string">"2012-12-12T12:12:12Z"</span>.parse::<DateTime<Utc>>()<span class="question-mark">?</span>;
|
||
<span class="string">"2012-12-12 12:12:12Z"</span>.parse::<DateTime<Utc>>()<span class="question-mark">?</span>;
|
||
<span class="string">"2012-12-12 12:12:12+0000"</span>.parse::<DateTime<Utc>>()<span class="question-mark">?</span>;
|
||
<span class="string">"2012-12-12 12:12:12+00:00"</span>.parse::<DateTime<Utc>>()<span class="question-mark">?</span>;</code></pre></div>
|
||
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Err-3" class="associatedtype trait-impl"><a href="#associatedtype.Err-3" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html#associatedtype.Err" class="associatedtype">Err</a> = <a class="struct" href="format/struct.ParseError.html" title="struct chrono::format::ParseError">ParseError</a></h4></section></summary><div class='docblock'>The associated error which can be returned from parsing.</div></details><details class="toggle method-toggle" open><summary><section id="method.from_str-2" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1373-1375">source</a><a href="#method.from_str-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html#tymethod.from_str" class="fn">from_str</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.str.html">str</a>) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>>></h4></section></summary><div class='docblock'>Parses a string <code>s</code> to return a value of this type. <a href="https://doc.rust-lang.org/1.76.0/core/str/traits/trait.FromStr.html#tymethod.from_str">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Hash-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1205-1209">source</a><a href="#impl-Hash-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.hash" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1206-1208">source</a><a href="#method.hash" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/hash/trait.Hash.html#tymethod.hash" class="fn">hash</a><H: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>>(&self, state: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&mut H</a>)</h4></section></summary><div class='docblock'>Feeds this value into the given <a href="https://doc.rust-lang.org/1.76.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.76.0/core/hash/trait.Hash.html#tymethod.hash">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.hash_slice" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span> · <a class="src" href="https://doc.rust-lang.org/1.76.0/src/core/hash/mod.rs.html#238-240">source</a></span><a href="#method.hash_slice" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/hash/trait.Hash.html#method.hash_slice" class="fn">hash_slice</a><H>(data: &<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.slice.html">[Self]</a>, state: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&mut H</a>)<div class="where">where
|
||
H: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/1.76.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.76.0/core/hash/trait.Hash.html#method.hash_slice">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Ord-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1199-1203">source</a><a href="#impl-Ord-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1200-1202">source</a><a href="#method.cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Ord.html#tymethod.cmp" class="fn">cmp</a>(&self, other: &<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class='docblock'>This method returns an <a href="https://doc.rust-lang.org/1.76.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering"><code>Ordering</code></a> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.max" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.76.0/src/core/cmp.rs.html#829-831">source</a></span><a href="#method.max" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Ord.html#method.max" class="fn">max</a>(self, other: Self) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Ord.html#method.max">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.min" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.76.0/src/core/cmp.rs.html#849-851">source</a></span><a href="#method.min" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Ord.html#method.min" class="fn">min</a>(self, other: Self) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Ord.html#method.min">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clamp" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span> · <a class="src" href="https://doc.rust-lang.org/1.76.0/src/core/cmp.rs.html#874-877">source</a></span><a href="#method.clamp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Ord.html#method.clamp" class="fn">clamp</a>(self, min: Self, max: Self) -> Self<div class="where">where
|
||
Self: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>,</div></h4></section></summary><div class='docblock'>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Ord.html#method.clamp">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1170-1174">source</a><a href="#impl-PartialEq%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>, Tz2: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz2>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1171-1173">source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz2>) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||
by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.76.0/src/core/cmp.rs.html#242">source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
|
||
sufficient, and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1178-1197">source</a><a href="#impl-PartialOrd%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>, Tz2: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz2>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1194-1196">source</a><a href="#method.partial_cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz2>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.76.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class="docblock"><p>Compare two DateTimes based on their true time, ignoring time zones</p>
|
||
<h5 id="example-10"><a href="#example-10">Example</a></h5>
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::prelude::<span class="kw-2">*</span>;
|
||
|
||
<span class="kw">let </span>earlier = Utc.with_ymd_and_hms(<span class="number">2015</span>, <span class="number">5</span>, <span class="number">15</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">0</span>).unwrap().with_timezone(<span class="kw-2">&</span>FixedOffset::west_opt(<span class="number">1 </span>* <span class="number">3600</span>).unwrap());
|
||
<span class="kw">let </span>later = Utc.with_ymd_and_hms(<span class="number">2015</span>, <span class="number">5</span>, <span class="number">15</span>, <span class="number">3</span>, <span class="number">0</span>, <span class="number">0</span>).unwrap().with_timezone(<span class="kw-2">&</span>FixedOffset::west_opt(<span class="number">5 </span>* <span class="number">3600</span>).unwrap());
|
||
|
||
<span class="macro">assert_eq!</span>(earlier.to_string(), <span class="string">"2015-05-15 01:00:00 -01:00"</span>);
|
||
<span class="macro">assert_eq!</span>(later.to_string(), <span class="string">"2015-05-14 22:00:00 -05:00"</span>);
|
||
|
||
<span class="macro">assert!</span>(later > earlier);</code></pre></div>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.lt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.76.0/src/core/cmp.rs.html#1125">source</a></span><a href="#method.lt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.76.0/src/core/cmp.rs.html#1142">source</a></span><a href="#method.le" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.76.0/src/core/cmp.rs.html#1158">source</a></span><a href="#method.gt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.76.0/src/core/cmp.rs.html#1175">source</a></span><a href="#method.ge" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code>
|
||
operator. <a href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Serialize-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#33-52">source</a><a href="#impl-Serialize-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="../serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="docblock"><p>Serialize into an ISO 8601 formatted string.</p>
|
||
<p>See <a href="./serde/index.html">the <code>serde</code> module</a> for alternate
|
||
serializations.</p>
|
||
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.serialize" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#34-51">source</a><a href="#method.serialize" class="anchor">§</a><h4 class="code-header">fn <a href="../serde/ser/trait.Serialize.html#tymethod.serialize" class="fn">serialize</a><S>(&self, serializer: S) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="associatedtype" href="../serde/ser/trait.Serializer.html#associatedtype.Ok" title="type serde::ser::Serializer::Ok">Ok</a>, S::<a class="associatedtype" href="../serde/ser/trait.Serializer.html#associatedtype.Error" title="type serde::ser::Serializer::Error">Error</a>><div class="where">where
|
||
S: <a class="trait" href="../serde/ser/trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a>,</div></h4></section></summary><div class='docblock'>Serialize this value into the given Serde serializer. <a href="../serde/ser/trait.Serialize.html#tymethod.serialize">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub%3C%26DateTime%3CTz%3E%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1314-1321">source</a><a href="#impl-Sub%3C%26DateTime%3CTz%3E%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><&<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-8" class="associatedtype trait-impl"><a href="#associatedtype.Output-8" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.sub-6" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1318-1320">source</a><a href="#method.sub-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, rhs: &<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>) -> <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">OldDuration</a></h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub%3CDays%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1331-1337">source</a><a href="#impl-Sub%3CDays%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><<a class="struct" href="naive/struct.Days.html" title="struct chrono::naive::Days">Days</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-2" class="associatedtype trait-impl"><a href="#associatedtype.Output-2" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.sub-2" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1334-1336">source</a><a href="#method.sub-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, days: <a class="struct" href="naive/struct.Days.html" title="struct chrono::naive::Days">Days</a>) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#associatedtype.Output" title="type core::ops::arith::Sub::Output">Output</a></h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub%3CDuration%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1267-1276">source</a><a href="#impl-Sub%3CDuration%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><<a class="struct" href="https://doc.rust-lang.org/1.76.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-1" class="associatedtype trait-impl"><a href="#associatedtype.Output-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.sub-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1271-1275">source</a><a href="#method.sub-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, rhs: <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub%3CDuration%3E-for-DateTime%3CTz%3E-1" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1258-1265">source</a><a href="#impl-Sub%3CDuration%3E-for-DateTime%3CTz%3E-1" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><<a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-7" class="associatedtype trait-impl"><a href="#associatedtype.Output-7" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.sub-5" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1262-1264">source</a><a href="#method.sub-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, rhs: <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">OldDuration</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub%3CFixedOffset%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/offset/fixed.rs.html#246-253">source</a><a href="#impl-Sub%3CFixedOffset%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-4" class="associatedtype trait-impl"><a href="#associatedtype.Output-4" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.sub-4" class="method trait-impl"><a class="src rightside" href="../src/chrono/offset/fixed.rs.html#250-252">source</a><a href="#method.sub-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, rhs: <a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub%3CMonths%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1297-1303">source</a><a href="#impl-Sub%3CMonths%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><<a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-3" class="associatedtype trait-impl"><a href="#associatedtype.Output-3" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.sub-3" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1300-1302">source</a><a href="#method.sub-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, rhs: <a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#associatedtype.Output" title="type core::ops::arith::Sub::Output">Output</a></h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1305-1312">source</a><a href="#impl-Sub-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl"><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.sub" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1309-1311">source</a><a href="#method.sub" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, rhs: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>) -> <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">OldDuration</a></h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1278-1286">source</a><a href="#impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.SubAssign.html" title="trait core::ops::arith::SubAssign">SubAssign</a><<a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.sub_assign" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1280-1285">source</a><a href="#method.sub_assign" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.SubAssign.html#tymethod.sub_assign" class="fn">sub_assign</a>(&mut self, rhs: <a class="struct" href="struct.Duration.html" title="struct chrono::Duration">OldDuration</a>)</h4></section></summary><div class='docblock'>Performs the <code>-=</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.SubAssign.html#tymethod.sub_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E-1" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1288-1295">source</a><a href="#impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E-1" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.SubAssign.html" title="trait core::ops::arith::SubAssign">SubAssign</a><<a class="struct" href="https://doc.rust-lang.org/1.76.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.sub_assign-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1290-1294">source</a><a href="#method.sub_assign-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.SubAssign.html#tymethod.sub_assign" class="fn">sub_assign</a>(&mut self, rhs: <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>)</h4></section></summary><div class='docblock'>Performs the <code>-=</code> operation. <a href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.SubAssign.html#tymethod.sub_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Timelike-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1084-1164">source</a><a href="#impl-Timelike-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="trait.Timelike.html" title="trait chrono::Timelike">Timelike</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_hour" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1113-1115">source</a><a href="#method.with_hour" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.with_hour" class="fn">with_hour</a>(&self, hour: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the hour number changed.</p>
|
||
<p>See also the <a href="naive/struct.NaiveTime.html#method.with_hour" title="method chrono::naive::NaiveTime::with_hour"><code>NaiveTime::with_hour</code></a> method.</p>
|
||
<h5 id="errors-15"><a href="#errors-15">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The value for <code>hour</code> is invalid.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_minute" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1127-1129">source</a><a href="#method.with_minute" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.with_minute" class="fn">with_minute</a>(&self, min: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the minute number changed.</p>
|
||
<p>See also the <a href="naive/struct.NaiveTime.html#method.with_minute" title="method chrono::naive::NaiveTime::with_minute"><code>NaiveTime::with_minute</code></a> method.</p>
|
||
<h5 id="errors-16"><a href="#errors-16">Errors</a></h5>
|
||
<ul>
|
||
<li>The value for <code>minute</code> is invalid.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_second" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1145-1147">source</a><a href="#method.with_second" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.with_second" class="fn">with_second</a>(&self, sec: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the second number changed.</p>
|
||
<p>As with the <a href="#method.second"><code>second</code></a> method,
|
||
the input range is restricted to 0 through 59.</p>
|
||
<p>See also the <a href="naive/struct.NaiveTime.html#method.with_second" title="method chrono::naive::NaiveTime::with_second"><code>NaiveTime::with_second</code></a> method.</p>
|
||
<h5 id="errors-17"><a href="#errors-17">Errors</a></h5>
|
||
<p>Returns <code>None</code> if:</p>
|
||
<ul>
|
||
<li>The value for <code>second</code> is invalid.</li>
|
||
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
|
||
daylight saving time transition.</li>
|
||
</ul>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_nanosecond" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1161-1163">source</a><a href="#method.with_nanosecond" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.with_nanosecond" class="fn">with_nanosecond</a>(&self, nano: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with nanoseconds since the whole non-leap second changed.</p>
|
||
<p>Returns <code>None</code> when the resulting <code>NaiveDateTime</code> would be invalid.
|
||
As with the <a href="naive/struct.NaiveDateTime.html#method.nanosecond" title="method chrono::naive::NaiveDateTime::nanosecond"><code>NaiveDateTime::nanosecond</code></a> method,
|
||
the input range can exceed 1,000,000,000 for leap seconds.</p>
|
||
<p>See also the <a href="naive/struct.NaiveTime.html#method.with_nanosecond" title="method chrono::naive::NaiveTime::with_nanosecond"><code>NaiveTime::with_nanosecond</code></a> method.</p>
|
||
<h5 id="errors-18"><a href="#errors-18">Errors</a></h5>
|
||
<p>Returns <code>None</code> if <code>nanosecond >= 2,000,000,000</code>.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.hour" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1086-1088">source</a><a href="#method.hour" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.hour" class="fn">hour</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the hour number from 0 to 23.</div></details><details class="toggle method-toggle" open><summary><section id="method.minute" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1090-1092">source</a><a href="#method.minute" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.minute" class="fn">minute</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the minute number from 0 to 59.</div></details><details class="toggle method-toggle" open><summary><section id="method.second" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1094-1096">source</a><a href="#method.second" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.second" class="fn">second</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the second number from 0 to 59.</div></details><details class="toggle method-toggle" open><summary><section id="method.nanosecond" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1098-1100">source</a><a href="#method.nanosecond" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.nanosecond" class="fn">nanosecond</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the number of nanoseconds since the whole non-leap second.
|
||
The range from 1,000,000,000 to 1,999,999,999 represents
|
||
the <a href="./naive/struct.NaiveTime.html#leap-second-handling">leap second</a>.</div></details><details class="toggle method-toggle" open><summary><section id="method.hour12" class="method trait-impl"><a class="src rightside" href="../src/chrono/traits.rs.html#274-281">source</a><a href="#method.hour12" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#method.hour12" class="fn">hour12</a>(&self) -> (<a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.bool.html">bool</a>, <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a>)</h4></section></summary><div class='docblock'>Returns the hour number from 1 to 12 with a boolean flag,
|
||
which is false for AM and true for PM.</div></details><details class="toggle method-toggle" open><summary><section id="method.num_seconds_from_midnight" class="method trait-impl"><a class="src rightside" href="../src/chrono/traits.rs.html#325-327">source</a><a href="#method.num_seconds_from_midnight" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#method.num_seconds_from_midnight" class="fn">num_seconds_from_midnight</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the number of non-leap seconds past the last midnight. <a href="trait.Timelike.html#method.num_seconds_from_midnight">Read more</a></div></details></div></details><section id="impl-Copy-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1167">source</a><a href="#impl-Copy-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
|
||
<Tz as <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>>::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>,</div></h3></section><section id="impl-Eq-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1176">source</a><a href="#impl-Eq-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section><section id="impl-Send-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1168">source</a><a href="#impl-Send-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
|
||
<Tz as <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>>::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-DateTime%3CTz%3E" class="impl"><a href="#impl-RefUnwindSafe-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
|
||
<Tz as <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>>::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</div></h3></section><section id="impl-Sync-for-DateTime%3CTz%3E" class="impl"><a href="#impl-Sync-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
|
||
<Tz as <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>>::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</div></h3></section><section id="impl-Unpin-for-DateTime%3CTz%3E" class="impl"><a href="#impl-Unpin-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
|
||
<Tz as <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>>::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h3></section><section id="impl-UnwindSafe-for-DateTime%3CTz%3E" class="impl"><a href="#impl-UnwindSafe-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
|
||
<Tz as <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>>::<a class="associatedtype" href="offset/trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</div></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#140">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
|
||
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/any.rs.html#141">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.76.0/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/1.76.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#210">source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#216">source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
|
||
T: ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/borrow.rs.html#217">source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.76.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#763">source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-9" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#766">source</a><a href="#method.from-9" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#747-749">source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#756">source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
|
||
<p>That is, this conversion is whatever the implementation of
|
||
<code><a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
|
||
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-SubsecRound-for-T" class="impl"><a class="src rightside" href="../src/chrono/round.rs.html#47-75">source</a><a href="#impl-SubsecRound-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.SubsecRound.html" title="trait chrono::SubsecRound">SubsecRound</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><<a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a>, Output = T> + <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><<a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a>, Output = T> + <a class="trait" href="trait.Timelike.html" title="trait chrono::Timelike">Timelike</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.round_subsecs" class="method trait-impl"><a class="src rightside" href="../src/chrono/round.rs.html#51-64">source</a><a href="#method.round_subsecs" class="anchor">§</a><h4 class="code-header">fn <a href="trait.SubsecRound.html#tymethod.round_subsecs" class="fn">round_subsecs</a>(self, digits: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u16.html">u16</a>) -> T</h4></section></summary><div class='docblock'>Return a copy rounded to the specified number of subsecond digits. With
|
||
9 or more digits, self is returned unmodified. Halfway values are
|
||
rounded up (away from zero). <a href="trait.SubsecRound.html#tymethod.round_subsecs">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.trunc_subsecs" class="method trait-impl"><a class="src rightside" href="../src/chrono/round.rs.html#66-74">source</a><a href="#method.trunc_subsecs" class="anchor">§</a><h4 class="code-header">fn <a href="trait.SubsecRound.html#tymethod.trunc_subsecs" class="fn">trunc_subsecs</a>(self, digits: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.u16.html">u16</a>) -> T</h4></section></summary><div class='docblock'>Return a copy truncated to the specified number of subsecond
|
||
digits. With 9 or more digits, self is returned unmodified. <a href="trait.SubsecRound.html#tymethod.trunc_subsecs">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#83-85">source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#88">source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&self) -> T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/alloc/borrow.rs.html#92">source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/1.76.0/std/primitive.reference.html">&mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.76.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToString-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/alloc/string.rs.html#2600">source</a><a href="#impl-ToString-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.76.0/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T<div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.76.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.to_string" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/alloc/string.rs.html#2606">source</a><a href="#method.to_string" class="anchor">§</a><h4 class="code-header">default fn <a href="https://doc.rust-lang.org/1.76.0/alloc/string/trait.ToString.html#tymethod.to_string" class="fn">to_string</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.76.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class='docblock'>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/1.76.0/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#803-805">source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#810">source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#788-790">source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
|
||
U: <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.76.0/src/core/convert/mod.rs.html#795">source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.76.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.76.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><section id="impl-DeserializeOwned-for-T" class="impl"><a class="src rightside" href="../src/serde/de/mod.rs.html#608">source</a><a href="#impl-DeserializeOwned-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="../serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a> for T<div class="where">where
|
||
T: for<'de> <a class="trait" href="../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a><'de>,</div></h3></section></div></section></div></main></body></html> |