date_component 0.4.8

the missed date_component with chrono. calculate date interval with chrono.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
<!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/SourceSerif4-Bold-a2c9cd1067f8b328.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-c4dbdcde0fbd8430.css" id="mainThemeStyle"><link rel="stylesheet" id="themeStyle" href="../static.files/light-db279b6232be9c13.css"><link rel="stylesheet" disabled href="../static.files/dark-cf923f49f397b216.css"><link rel="stylesheet" disabled href="../static.files/ayu-be46fdc453a55015.css"><script src="../static.files/storage-3891ce972e3a2bf8.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-98a684e84ae5b08b.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-13285aec31fa243e.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">&#9776;</button><a class="logo-container" href="../chrono/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../chrono/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">DateTime</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Associated Constants</a></h3><ul class="block"><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"><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"><li><a href="#impl-Add%3CDays%3E-for-DateTime%3CTz%3E">Add&lt;Days&gt;</a></li><li><a href="#impl-Add%3CDuration%3E-for-DateTime%3CTz%3E">Add&lt;Duration&gt;</a></li><li><a href="#impl-Add%3CDuration%3E-for-DateTime%3CTz%3E-1">Add&lt;Duration&gt;</a></li><li><a href="#impl-Add%3CFixedOffset%3E-for-DateTime%3CTz%3E">Add&lt;FixedOffset&gt;</a></li><li><a href="#impl-Add%3CMonths%3E-for-DateTime%3CTz%3E">Add&lt;Months&gt;</a></li><li><a href="#impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E">AddAssign&lt;Duration&gt;</a></li><li><a href="#impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E-1">AddAssign&lt;Duration&gt;</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-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&lt;DateTime&lt;FixedOffset&gt;&gt;</a></li><li><a href="#impl-From%3CDateTime%3CFixedOffset%3E%3E-for-DateTime%3CUtc%3E">From&lt;DateTime&lt;FixedOffset&gt;&gt;</a></li><li><a href="#impl-From%3CDateTime%3CLocal%3E%3E-for-DateTime%3CFixedOffset%3E">From&lt;DateTime&lt;Local&gt;&gt;</a></li><li><a href="#impl-From%3CDateTime%3CLocal%3E%3E-for-DateTime%3CUtc%3E">From&lt;DateTime&lt;Local&gt;&gt;</a></li><li><a href="#impl-From%3CDateTime%3CTz%3E%3E-for-SystemTime">From&lt;DateTime&lt;Tz&gt;&gt;</a></li><li><a href="#impl-From%3CDateTime%3CUtc%3E%3E-for-DateTime%3CFixedOffset%3E">From&lt;DateTime&lt;Utc&gt;&gt;</a></li><li><a href="#impl-From%3CDateTime%3CUtc%3E%3E-for-DateTime%3CLocal%3E">From&lt;DateTime&lt;Utc&gt;&gt;</a></li><li><a href="#impl-From%3CSystemTime%3E-for-DateTime%3CLocal%3E">From&lt;SystemTime&gt;</a></li><li><a href="#impl-From%3CSystemTime%3E-for-DateTime%3CUtc%3E">From&lt;SystemTime&gt;</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&lt;DateTime&lt;Tz2&gt;&gt;</a></li><li><a href="#impl-PartialOrd%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E">PartialOrd&lt;DateTime&lt;Tz2&gt;&gt;</a></li><li><a href="#impl-Send-for-DateTime%3CTz%3E">Send</a></li><li><a href="#impl-Sub%3C%26DateTime%3CTz%3E%3E-for-DateTime%3CTz%3E">Sub&lt;&amp;DateTime&lt;Tz&gt;&gt;</a></li><li><a href="#impl-Sub%3CDateTime%3CTz%3E%3E-for-DateTime%3CTz%3E">Sub&lt;DateTime&lt;Tz&gt;&gt;</a></li><li><a href="#impl-Sub%3CDays%3E-for-DateTime%3CTz%3E">Sub&lt;Days&gt;</a></li><li><a href="#impl-Sub%3CDuration%3E-for-DateTime%3CTz%3E">Sub&lt;Duration&gt;</a></li><li><a href="#impl-Sub%3CDuration%3E-for-DateTime%3CTz%3E-1">Sub&lt;Duration&gt;</a></li><li><a href="#impl-Sub%3CFixedOffset%3E-for-DateTime%3CTz%3E">Sub&lt;FixedOffset&gt;</a></li><li><a href="#impl-Sub%3CMonths%3E-for-DateTime%3CTz%3E">Sub&lt;Months&gt;</a></li><li><a href="#impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E">SubAssign&lt;Duration&gt;</a></li><li><a href="#impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E-1">SubAssign&lt;Duration&gt;</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"><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"><li><a href="#impl-Any-for-DateTime%3CTz%3E">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-DateTime%3CTz%3E">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-DateTime%3CTz%3E">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-DateTime%3CTz%3E">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-DateTime%3CTz%3E">Into&lt;U&gt;</a></li><li><a href="#impl-ToOwned-for-DateTime%3CTz%3E">ToOwned</a></li><li><a href="#impl-ToString-for-DateTime%3CTz%3E">ToString</a></li><li><a href="#impl-TryFrom%3CU%3E-for-DateTime%3CTz%3E">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-DateTime%3CTz%3E">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In chrono</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><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" title="help" tabindex="-1"><a href="../help.html">?</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="srclink" href="../src/chrono/datetime/mod.rs.html#86-89">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct DateTime&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; { /* private fields */ }</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="small-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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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="srclink 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>
) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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::&lt;Local&gt;::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="srclink 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>) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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="srclink 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>) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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="srclink 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>(&amp;self) -&gt; <a class="struct" href="struct.Date.html" title="struct chrono::Date">Date</a>&lt;Tz&gt;</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="srclink 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>(&amp;self) -&gt; <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&lt;Utc&gt; = 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&lt;FixedOffset&gt; = 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="srclink 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>(&amp;self) -&gt; <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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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&lt;Utc&gt; = 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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.i64.html">i64</a>&gt;</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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; &amp;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="srclink 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>(&amp;self) -&gt; 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="srclink 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>&lt;Tz2: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt;(&amp;self, tz: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.reference.html">&amp;Tz2</a>) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz2&gt;</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="srclink 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>(&amp;self) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;</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&lt;Tz: Timezone&gt;</code> to <code>DateTime&lt;FixedOffset&gt;</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_add_signed" class="method"><a class="srclink 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>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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="srclink 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>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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="srclink 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>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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="srclink 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>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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="srclink 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>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self&gt;</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="srclink 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>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self&gt;</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="srclink 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>&lt;Tz2: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt;(
    self,
    rhs: impl <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz2&gt;&gt;
) -&gt; <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="srclink 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>(&amp;self) -&gt; <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="srclink 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>(&amp;self) -&gt; <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="srclink 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>(&amp;self, base: Self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.u32.html">u32</a>&gt;</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 &lt; self</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_rfc2822" class="method"><a class="srclink 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>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;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.69.0/std/primitive.bool.html">bool</a>) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.69.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">&quot;2018-01-26T18:30:09.453+00:00&quot;</span>);
<span class="macro">assert_eq!</span>(dt.to_rfc3339_opts(SecondsFormat::Millis, <span class="bool-val">true</span>),
           <span class="string">&quot;2018-01-26T18:30:09.453Z&quot;</span>);
<span class="macro">assert_eq!</span>(dt.to_rfc3339_opts(SecondsFormat::Secs, <span class="bool-val">true</span>),
           <span class="string">&quot;2018-01-26T18:30:09Z&quot;</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">&amp;</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">&quot;2018-01-26T10:30:09+08:00&quot;</span>);</code></pre></div>
</div></details><details class="toggle" open><summary><section id="associatedconstant.MIN_UTC" class="associatedconstant"><a class="srclink 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>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt; = _</h4></section></summary><div class="docblock"><p>The minimum possible <code>DateTime&lt;Utc&gt;</code>.</p>
</div></details><details class="toggle" open><summary><section id="associatedconstant.MAX_UTC" class="associatedconstant"><a class="srclink 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>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt; = _</h4></section></summary><div class="docblock"><p>The maximum possible <code>DateTime&lt;Utc&gt;</code>.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-DateTime%3CUtc%3E" class="impl"><a class="srclink 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>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from_timestamp" class="method"><a class="srclink 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.69.0/std/primitive.i64.html">i64</a>, nsecs: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>Makes a new <a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime&lt;Utc&gt;</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&lt;Utc&gt; = DateTime::&lt;Utc&gt;::from_timestamp(<span class="number">1431648000</span>, <span class="number">0</span>).expect(<span class="string">&quot;invalid timestamp&quot;</span>);

<span class="macro">assert_eq!</span>(dt.to_string(), <span class="string">&quot;2015-05-15 00:00:00 UTC&quot;</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="srclink 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="srclink 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>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.parse_from_rfc2822" class="method"><a class="srclink 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: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.str.html">str</a>) -&gt; <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Parses an RFC 2822 date-and-time string into a <code>DateTime&lt;FixedOffset&gt;</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">&quot;Wed, 18 Feb 2015 23:16:09 GMT&quot;</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="srclink 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: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.str.html">str</a>) -&gt; <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Parses an RFC 3339 date-and-time string into a <code>DateTime&lt;FixedOffset&gt;</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="srclink 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: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.str.html">str</a>, fmt: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.str.html">str</a>) -&gt; <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Parses a string from a user-specified format into a <code>DateTime&lt;FixedOffset&gt;</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">&quot;1983 Apr 13 12:09:14.274 +0000&quot;</span>, <span class="string">&quot;%Y %b %d %H:%M:%S%.3f %z&quot;</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">&amp;</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="srclink 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>&lt;'a&gt;(
    s: &amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.str.html">str</a>,
    fmt: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.str.html">str</a>
) -&gt; <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a>&lt;(<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;, &amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.str.html">str</a>)&gt;</h4></section></summary><div class="docblock"><p>Parses a string from a user-specified format into a <code>DateTime&lt;FixedOffset&gt;</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">&quot;2015-02-18 23:16:09 +0200 trailing text&quot;</span>, <span class="string">&quot;%Y-%m-%d %H:%M:%S %z&quot;</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">&quot; trailing text&quot;</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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;<span class="where fmt-newline">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.69.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.format_with_items" class="method"><a class="srclink 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>&lt;'a, I, B&gt;(&amp;self, items: I) -&gt; <a class="struct" href="format/struct.DelayedFormat.html" title="struct chrono::format::DelayedFormat">DelayedFormat</a>&lt;I&gt;<span class="where fmt-newline">where
    I: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a>&lt;Item = B&gt; + <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
    B: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;<a class="enum" href="format/enum.Item.html" title="enum chrono::format::Item">Item</a>&lt;'a&gt;&gt;,</span></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="srclink 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>&lt;'a&gt;(&amp;self, fmt: &amp;'a <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.str.html">str</a>) -&gt; <a class="struct" href="format/struct.DelayedFormat.html" title="struct chrono::format::DelayedFormat">DelayedFormat</a>&lt;<a class="struct" href="format/strftime/struct.StrftimeItems.html" title="struct chrono::format::strftime::StrftimeItems">StrftimeItems</a>&lt;'a&gt;&gt;</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&lt;Utc&gt; = 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">&quot;{}&quot;</span>, date_time.format(<span class="string">&quot;%d/%m/%Y %H:%M&quot;</span>));
<span class="macro">assert_eq!</span>(formatted, <span class="string">&quot;02/04/2017 12:50&quot;</span>);</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="small-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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a>&lt;<a class="struct" href="naive/struct.Days.html" title="struct chrono::naive::Days">Days</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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.69.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>&lt;Tz&gt;</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="srclink 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.69.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>) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.69.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.69.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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1211-1218">source</a><a href="#impl-Add%3CDuration%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a>&lt;<a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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.69.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>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1215-1217">source</a><a href="#method.add-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</h4></section></summary><div class='docblock'>Performs the <code>+</code> operation. <a href="https://doc.rust-lang.org/1.69.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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1220-1229">source</a><a href="#impl-Add%3CDuration%3E-for-DateTime%3CTz%3E-1" class="anchor">§</a><h3 class="code-header">impl&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.69.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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.69.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>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1224-1228">source</a><a href="#method.add-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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.69.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</h4></section></summary><div class='docblock'>Performs the <code>+</code> operation. <a href="https://doc.rust-lang.org/1.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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.69.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>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/offset/fixed.rs.html#241-243">source</a><a href="#method.add" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</h4></section></summary><div class='docblock'>Performs the <code>+</code> operation. <a href="https://doc.rust-lang.org/1.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a>&lt;<a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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.69.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>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1253-1255">source</a><a href="#method.add-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.69.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.69.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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1231-1239">source</a><a href="#impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.AddAssign.html" title="trait core::ops::arith::AddAssign">AddAssign</a>&lt;<a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1233-1238">source</a><a href="#method.add_assign" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.AddAssign.html#tymethod.add_assign" class="fn">add_assign</a>(&amp;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.69.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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1241-1248">source</a><a href="#impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E-1" class="anchor">§</a><h3 class="code-header">impl&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.AddAssign.html" title="trait core::ops::arith::AddAssign">AddAssign</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.69.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1243-1247">source</a><a href="#method.add_assign-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.AddAssign.html#tymethod.add_assign" class="fn">add_assign</a>(&amp;mut self, rhs: <a class="struct" href="https://doc.rust-lang.org/1.69.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.69.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="srclink 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&lt;Tz: <a class="trait" href="https://doc.rust-lang.org/1.69.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>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;<span class="where fmt-newline">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.69.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="srclink 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.69.0/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.69.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="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/clone.rs.html#132-134">source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.reference.html">&amp;Self</a>)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <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>&lt;Tz&gt;</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="srclink 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>(&amp;self, year: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.i32.html">i32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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-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>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="srclink 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>(&amp;self, month: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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-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>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="srclink 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>(&amp;self, month0: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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-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>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="srclink 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>(&amp;self, day: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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-15"><a href="#errors-15">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="srclink 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>(&amp;self, day0: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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-16"><a href="#errors-16">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="srclink 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>(&amp;self, ordinal: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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-17"><a href="#errors-17">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="srclink 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>(&amp;self, ordinal0: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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-18"><a href="#errors-18">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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <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="srclink 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>(&amp;self) -&gt; <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="srclink 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>(&amp;self) -&gt; (<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.bool.html">bool</a>, <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1340-1343">source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.69.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.69.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.69.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="srclink 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.69.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>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#646-648">source</a><a href="#method.default-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.69.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="srclink 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.69.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>&lt;<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="srclink rightside" href="../src/chrono/datetime/mod.rs.html#640-642">source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.69.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="srclink 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.69.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>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt;</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="srclink 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.69.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -&gt; Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.69.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-Display-for-DateTime%3CTz%3E" class="impl"><a class="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;<span class="where fmt-newline">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.69.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,</span></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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1350-1354">source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/fmt/trait.Display.html#tymethod.fmt" class="fn">fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/1.69.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="type" href="https://doc.rust-lang.org/1.69.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.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <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>&lt;Tz&gt;</h3></section></summary><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="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="srclink 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>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, Self::<a class="associatedtype" href="trait.DurationRound.html#associatedtype.Err" title="type chrono::DurationRound::Err">Err</a>&gt;</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="srclink 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>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;Self, Self::<a class="associatedtype" href="trait.DurationRound.html#associatedtype.Err" title="type chrono::DurationRound::Err">Err</a>&gt;</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="srclink 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.69.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>&gt;</h3></section></summary><div class="docblock"><p>Convert a <code>DateTime&lt;FixedOffset&gt;</code> instance into a <code>DateTime&lt;Local&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#693-695">source</a><a href="#method.from-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime&lt;FixedOffset&gt;</code> instance into a <code>DateTime&lt;Local&gt;</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="srclink 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.69.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt;</h3></section></summary><div class="docblock"><p>Convert a <code>DateTime&lt;FixedOffset&gt;</code> instance into a <code>DateTime&lt;Utc&gt;</code> instance.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-7" class="method trait-impl"><a class="srclink rightside" href="../src/chrono/datetime/mod.rs.html#680-682">source</a><a href="#method.from-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime&lt;FixedOffset&gt;</code> instance into a <code>DateTime&lt;Utc&gt;</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="srclink 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.69.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>&gt;&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;</h3></section></summary><div class="docblock"><p>Convert a <code>DateTime&lt;Local&gt;</code> instance into a <code>DateTime&lt;FixedOffset&gt;</code> instance.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a class="srclink rightside" href="../src/chrono/datetime/mod.rs.html#718-720">source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>&lt;<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime&lt;Local&gt;</code> instance into a <code>DateTime&lt;FixedOffset&gt;</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="srclink 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.69.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>&gt;&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt;</h3></section></summary><div class="docblock"><p>Convert a <code>DateTime&lt;Local&gt;</code> instance into a <code>DateTime&lt;Utc&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#706-708">source</a><a href="#method.from-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>&lt;<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime&lt;Local&gt;</code> instance into a <code>DateTime&lt;Utc&gt;</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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt; for <a class="struct" href="https://doc.rust-lang.org/1.69.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="srclink 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.69.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>&lt;Tz&gt;) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.69.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="srclink 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.69.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt;&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;</h3></section></summary><div class="docblock"><p>Convert a <code>DateTime&lt;Utc&gt;</code> instance into a <code>DateTime&lt;FixedOffset&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#657-659">source</a><a href="#method.from-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime&lt;Utc&gt;</code> instance into a <code>DateTime&lt;FixedOffset&gt;</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="srclink 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.69.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt;&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>&gt;</h3></section></summary><div class="docblock"><p>Convert a <code>DateTime&lt;Utc&gt;</code> instance into a <code>DateTime&lt;Local&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#669-671">source</a><a href="#method.from-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt;) -&gt; Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime&lt;Utc&gt;</code> instance into a <code>DateTime&lt;Local&gt;</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="srclink 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.69.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.69.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-3" class="method trait-impl"><a class="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1425-1427">source</a><a href="#method.from-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: <a class="struct" href="https://doc.rust-lang.org/1.69.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a>) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>&gt;</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="srclink 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.69.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.69.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-4" class="method trait-impl"><a class="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1404-1419">source</a><a href="#method.from-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: <a class="struct" href="https://doc.rust-lang.org/1.69.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a>) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt;</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="srclink 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.69.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>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;</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">&quot;2012-12-12T12:12:12Z&quot;</span>.parse::&lt;DateTime&lt;FixedOffset&gt;&gt;()<span class="question-mark">?</span>;
<span class="string">&quot;2012-12-12 12:12:12Z&quot;</span>.parse::&lt;DateTime&lt;FixedOffset&gt;&gt;()<span class="question-mark">?</span>;
<span class="string">&quot;2012-  12-12T12:  12:12Z&quot;</span>.parse::&lt;DateTime&lt;FixedOffset&gt;&gt;()<span class="question-mark">?</span>;</code></pre></div>
</div><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="https://doc.rust-lang.org/1.69.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="srclink rightside" href="../src/chrono/format/parse.rs.html#530-537">source</a><a href="#method.from_str-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/str/traits/trait.FromStr.html#tymethod.from_str" class="fn">from_str</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.str.html">str</a>) -&gt; <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt;&gt;</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.69.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="srclink 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.69.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>&lt;<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>&gt;</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">&quot;2012-12-12T12:12:12Z&quot;</span>.parse::&lt;DateTime&lt;Local&gt;&gt;()<span class="question-mark">?</span>;
<span class="string">&quot;2012-12-12 12:12:12Z&quot;</span>.parse::&lt;DateTime&lt;Local&gt;&gt;()<span class="question-mark">?</span>;
<span class="string">&quot;2012-12-12 12:12:12+0000&quot;</span>.parse::&lt;DateTime&lt;Local&gt;&gt;()<span class="question-mark">?</span>;
<span class="string">&quot;2012-12-12 12:12:12+00:00&quot;</span>.parse::&lt;DateTime&lt;Local&gt;&gt;()<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.69.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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1396-1398">source</a><a href="#method.from_str-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/str/traits/trait.FromStr.html#tymethod.from_str" class="fn">from_str</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.str.html">str</a>) -&gt; <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Local.html" title="struct chrono::offset::Local">Local</a>&gt;&gt;</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.69.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="srclink 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.69.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>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt;</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">&quot;2012-12-12T12:12:12Z&quot;</span>.parse::&lt;DateTime&lt;Utc&gt;&gt;()<span class="question-mark">?</span>;
<span class="string">&quot;2012-12-12 12:12:12Z&quot;</span>.parse::&lt;DateTime&lt;Utc&gt;&gt;()<span class="question-mark">?</span>;
<span class="string">&quot;2012-12-12 12:12:12+0000&quot;</span>.parse::&lt;DateTime&lt;Utc&gt;&gt;()<span class="question-mark">?</span>;
<span class="string">&quot;2012-12-12 12:12:12+00:00&quot;</span>.parse::&lt;DateTime&lt;Utc&gt;&gt;()<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.69.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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1373-1375">source</a><a href="#method.from_str" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/str/traits/trait.FromStr.html#tymethod.from_str" class="fn">from_str</a>(s: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.str.html">str</a>) -&gt; <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;<a class="struct" href="offset/struct.Utc.html" title="struct chrono::offset::Utc">Utc</a>&gt;&gt;</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.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.hash" class="method trait-impl"><a class="srclink 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.69.0/core/hash/trait.Hash.html#tymethod.hash" class="fn">hash</a>&lt;H: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>&gt;(&amp;self, state: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.reference.html">&amp;mut H</a>)</h4></section></summary><div class='docblock'>Feeds this value into the given <a href="https://doc.rust-lang.org/1.69.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.69.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="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/hash/mod.rs.html#239-241">source</a></span><a href="#method.hash_slice" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/hash/trait.Hash.html#method.hash_slice" class="fn">hash_slice</a>&lt;H&gt;(data: &amp;<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.slice.html">[Self]</a>, state: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.reference.html">&amp;mut H</a>)<span class="where fmt-newline">where
    H: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,
    Self: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h4></section></summary><div class='docblock'>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/1.69.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><a class="srclink 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.69.0/core/cmp/trait.Ord.html#tymethod.cmp" class="fn">cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.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.69.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.69.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="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/cmp.rs.html#798-801">source</a></span><a href="#method.max" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/cmp/trait.Ord.html#method.max" class="fn">max</a>(self, other: Self) -&gt; Self<span class="where fmt-newline">where
    Self: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h4></section></summary><div class='docblock'>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/1.69.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="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/cmp.rs.html#822-825">source</a></span><a href="#method.min" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/cmp/trait.Ord.html#method.min" class="fn">min</a>(self, other: Self) -&gt; Self<span class="where fmt-newline">where
    Self: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h4></section></summary><div class='docblock'>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/1.69.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="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/cmp.rs.html#851-855">source</a></span><a href="#method.clamp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/cmp/trait.Ord.html#method.clamp" class="fn">clamp</a>(self, min: Self, max: Self) -&gt; Self<span class="where fmt-newline">where
    Self: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;Self&gt;,</span></h4></section></summary><div class='docblock'>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/1.69.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="srclink 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&lt;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>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz2&gt;&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><a class="srclink 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.69.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz2&gt;) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/cmp.rs.html#229">source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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&lt;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>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz2&gt;&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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="srclink 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.69.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz2&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/1.69.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</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">&amp;</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">&amp;</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">&quot;2015-05-15 01:00:00 -01:00&quot;</span>);
<span class="macro">assert_eq!</span>(later.to_string(), <span class="string">&quot;2015-05-14 22:00:00 -05:00&quot;</span>);

<span class="macro">assert!</span>(later &gt; 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="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/cmp.rs.html#1086">source</a></span><a href="#method.lt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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>&lt;</code> operator. <a href="https://doc.rust-lang.org/1.69.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="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/cmp.rs.html#1105">source</a></span><a href="#method.le" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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>&lt;=</code>
operator. <a href="https://doc.rust-lang.org/1.69.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="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/cmp.rs.html#1123">source</a></span><a href="#method.gt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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>&gt;</code> operator. <a href="https://doc.rust-lang.org/1.69.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="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/cmp.rs.html#1142">source</a></span><a href="#method.ge" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.reference.html">&amp;Rhs</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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>&gt;=</code>
operator. <a href="https://doc.rust-lang.org/1.69.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-Sub%3C%26DateTime%3CTz%3E%3E-for-DateTime%3CTz%3E" class="impl"><a class="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a>&lt;&amp;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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.69.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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1318-1320">source</a><a href="#method.sub" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, rhs: &amp;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;) -&gt; <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.69.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%3CDateTime%3CTz%3E%3E-for-DateTime%3CTz%3E" class="impl"><a class="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1305-1312">source</a><a href="#impl-Sub%3CDateTime%3CTz%3E%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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.69.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-5" class="method trait-impl"><a class="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1309-1311">source</a><a href="#method.sub-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;) -&gt; <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.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a>&lt;<a class="struct" href="naive/struct.Days.html" title="struct chrono::naive::Days">Days</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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.69.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>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1334-1336">source</a><a href="#method.sub-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.69.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.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.69.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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.69.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>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1271-1275">source</a><a href="#method.sub-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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.69.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a>&lt;<a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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.69.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>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1262-1264">source</a><a href="#method.sub-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a>&lt;<a class="struct" href="offset/struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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.69.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>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/offset/fixed.rs.html#250-252">source</a><a href="#method.sub-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>) -&gt; <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a>&lt;<a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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.69.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>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1300-1302">source</a><a href="#method.sub-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.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>) -&gt; Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.69.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.69.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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1288-1295">source</a><a href="#impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.SubAssign.html" title="trait core::ops::arith::SubAssign">SubAssign</a>&lt;<a class="struct" href="https://doc.rust-lang.org/1.69.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1290-1294">source</a><a href="#method.sub_assign" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.SubAssign.html#tymethod.sub_assign" class="fn">sub_assign</a>(&amp;mut self, rhs: <a class="struct" href="https://doc.rust-lang.org/1.69.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.69.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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1278-1286">source</a><a href="#impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E-1" class="anchor">§</a><h3 class="code-header">impl&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.SubAssign.html" title="trait core::ops::arith::SubAssign">SubAssign</a>&lt;<a class="struct" href="struct.Duration.html" title="struct chrono::Duration">Duration</a>&gt; for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;</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="srclink rightside" href="../src/chrono/datetime/mod.rs.html#1280-1285">source</a><a href="#method.sub_assign-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/ops/arith/trait.SubAssign.html#tymethod.sub_assign" class="fn">sub_assign</a>(&amp;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.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <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>&lt;Tz&gt;</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="srclink 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>(&amp;self, hour: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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-8"><a href="#errors-8">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="srclink 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>(&amp;self, min: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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-9"><a href="#errors-9">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="srclink 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>(&amp;self, sec: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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-10"><a href="#errors-10">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="srclink 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>(&amp;self, nano: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.u32.html">u32</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a>&lt;Tz&gt;&gt;</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-11"><a href="#errors-11">Errors</a></h5>
<p>Returns <code>None</code> if <code>nanosecond &gt;= 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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; (<a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.bool.html">bool</a>, <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.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="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;<span class="where fmt-newline">where
    &lt;Tz as <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt;::<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.69.0/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>,</span></h3></section><section id="impl-Eq-for-DateTime%3CTz%3E" class="impl"><a class="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;</h3></section><section id="impl-Send-for-DateTime%3CTz%3E" class="impl"><a class="srclink 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&lt;Tz: <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;<span class="where fmt-newline">where
    &lt;Tz as <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt;::<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.69.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</span></h3></section></div><h2 id="synthetic-implementations" class="small-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&lt;Tz&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;<span class="where fmt-newline">where
    &lt;Tz as <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt;::<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.69.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</span></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&lt;Tz&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;<span class="where fmt-newline">where
    &lt;Tz as <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt;::<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.69.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</span></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&lt;Tz&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;<span class="where fmt-newline">where
    &lt;Tz as <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt;::<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.69.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</span></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&lt;Tz&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.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>&lt;Tz&gt;<span class="where fmt-newline">where
    &lt;Tz as <a class="trait" href="offset/trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a>&gt;::<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.69.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</span></h3></section></div><h2 id="blanket-implementations" class="small-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-DateTime%3CTz%3E" class="impl"><a class="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/core/any.rs.html#200">source</a><a href="#impl-Any-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<span class="where fmt-newline">where
    T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.69.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></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="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/core/any.rs.html#201">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.69.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.69.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-DateTime%3CTz%3E" class="impl"><a class="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/core/borrow.rs.html#211">source</a><a href="#impl-Borrow%3CT%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<span class="where fmt-newline">where
    T: ?<a class="trait" href="https://doc.rust-lang.org/1.69.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/borrow.rs.html#213">source</a></span><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.reference.html">&amp;T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.69.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-DateTime%3CTz%3E" class="impl"><a class="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/core/borrow.rs.html#220">source</a><a href="#impl-BorrowMut%3CT%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<span class="where fmt-newline">where
    T: ?<a class="trait" href="https://doc.rust-lang.org/1.69.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/borrow.rs.html#221">source</a></span><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.reference.html">&amp;mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.69.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-DateTime%3CTz%3E" class="impl"><a class="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/core/convert/mod.rs.html#733">source</a><a href="#impl-From%3CT%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; 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"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/convert/mod.rs.html#736">source</a></span><a href="#method.from-9" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -&gt; 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-DateTime%3CTz%3E" class="impl"><a class="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/core/convert/mod.rs.html#717">source</a><a href="#impl-Into%3CU%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<span class="where fmt-newline">where
    U: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/convert/mod.rs.html#725">source</a></span><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -&gt; 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.69.0/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-DateTime%3CTz%3E" class="impl"><a class="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/alloc/borrow.rs.html#82">source</a><a href="#impl-ToOwned-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<span class="where fmt-newline">where
    T: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</span></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.69.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="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/alloc/borrow.rs.html#87">source</a><a href="#method.to_owned" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.69.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="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/alloc/borrow.rs.html#91">source</a><a href="#method.clone_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/1.69.0/std/primitive.reference.html">&amp;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.69.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-DateTime%3CTz%3E" class="impl"><a class="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/alloc/string.rs.html#2522">source</a><a href="#impl-ToString-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T<span class="where fmt-newline">where
    T: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.69.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></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="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/alloc/string.rs.html#2528">source</a><a href="#method.to_string" class="anchor">§</a><h4 class="code-header">default fn <a href="https://doc.rust-lang.org/1.69.0/alloc/string/trait.ToString.html#tymethod.to_string" class="fn">to_string</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/1.69.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.69.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-DateTime%3CTz%3E" class="impl"><a class="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/core/convert/mod.rs.html#775">source</a><a href="#impl-TryFrom%3CU%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<span class="where fmt-newline">where
    U: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</span></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.69.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.69.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"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/convert/mod.rs.html#781">source</a></span><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</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-DateTime%3CTz%3E" class="impl"><a class="srclink rightside" href="https://doc.rust-lang.org/1.69.0/src/core/convert/mod.rs.html#760">source</a><a href="#impl-TryInto%3CU%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<span class="where fmt-newline">where
    U: <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</span></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.69.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.69.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"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/1.69.0/src/core/convert/mod.rs.html#766">source</a></span><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.69.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.69.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/1.69.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="chrono" data-themes="" data-resource-suffix="" data-rustdoc-version="1.69.0 (84c898d65 2023-04-16) (built from a source tarball)" data-search-js="search-8a59a8356673ec1f.js" data-settings-js="settings-f0c5c39777a9a2f6.js" data-settings-css="settings-0bcba95ff279c1db.css" ></div></body></html>