-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathstruct.DateTime.html
795 lines (761 loc) · 247 KB
/
struct.DateTime.html
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
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
<!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><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-46132b98.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="chrono" data-themes="" data-resource-suffix="" data-rustdoc-version="1.85.0 (4d91de4e4 2025-02-17)" data-channel="1.85.0" data-search-js="search-75f5ac3e.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.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" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../chrono/index.html">chrono</a><span class="version">0.4.40</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Date<wbr>Time</a></h2><h3><a href="#fields">Fields</a></h3><ul class="block structfield"><li><a href="#structfield.datetime" title="datetime">datetime</a></li><li><a href="#structfield.offset" title="offset">offset</a></li></ul><h3><a href="#implementations">Associated Constants</a></h3><ul class="block associatedconstant"><li><a href="#associatedconstant.MAX_UTC" title="MAX_UTC">MAX_UTC</a></li><li><a href="#associatedconstant.MIN_UTC" title="MIN_UTC">MIN_UTC</a></li><li><a href="#associatedconstant.UNIX_EPOCH" title="UNIX_EPOCH">UNIX_EPOCH</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.checked_add_days" title="checked_add_days">checked_add_days</a></li><li><a href="#method.checked_add_months" title="checked_add_months">checked_add_months</a></li><li><a href="#method.checked_add_signed" title="checked_add_signed">checked_add_signed</a></li><li><a href="#method.checked_sub_days" title="checked_sub_days">checked_sub_days</a></li><li><a href="#method.checked_sub_months" title="checked_sub_months">checked_sub_months</a></li><li><a href="#method.checked_sub_signed" title="checked_sub_signed">checked_sub_signed</a></li><li><a href="#method.date" title="date">date</a></li><li><a href="#method.date_naive" title="date_naive">date_naive</a></li><li><a href="#method.fixed_offset" title="fixed_offset">fixed_offset</a></li><li><a href="#method.format" title="format">format</a></li><li><a href="#method.format_with_items" title="format_with_items">format_with_items</a></li><li><a href="#method.from_local" title="from_local">from_local</a></li><li><a href="#method.from_naive_utc_and_offset" title="from_naive_utc_and_offset">from_naive_utc_and_offset</a></li><li><a href="#method.from_timestamp" title="from_timestamp">from_timestamp</a></li><li><a href="#method.from_timestamp_micros" title="from_timestamp_micros">from_timestamp_micros</a></li><li><a href="#method.from_timestamp_millis" title="from_timestamp_millis">from_timestamp_millis</a></li><li><a href="#method.from_timestamp_nanos" title="from_timestamp_nanos">from_timestamp_nanos</a></li><li><a href="#method.from_utc" title="from_utc">from_utc</a></li><li><a href="#method.naive_local" title="naive_local">naive_local</a></li><li><a href="#method.naive_utc" title="naive_utc">naive_utc</a></li><li><a href="#method.offset" title="offset">offset</a></li><li><a href="#method.overflowing_naive_local" title="overflowing_naive_local">overflowing_naive_local</a></li><li><a href="#method.parse_and_remainder" title="parse_and_remainder">parse_and_remainder</a></li><li><a href="#method.parse_from_rfc2822" title="parse_from_rfc2822">parse_from_rfc2822</a></li><li><a href="#method.parse_from_rfc3339" title="parse_from_rfc3339">parse_from_rfc3339</a></li><li><a href="#method.parse_from_str" title="parse_from_str">parse_from_str</a></li><li><a href="#method.signed_duration_since" title="signed_duration_since">signed_duration_since</a></li><li><a href="#method.time" title="time">time</a></li><li><a href="#method.timestamp" title="timestamp">timestamp</a></li><li><a href="#method.timestamp_micros" title="timestamp_micros">timestamp_micros</a></li><li><a href="#method.timestamp_millis" title="timestamp_millis">timestamp_millis</a></li><li><a href="#method.timestamp_nanos" title="timestamp_nanos">timestamp_nanos</a></li><li><a href="#method.timestamp_nanos_opt" title="timestamp_nanos_opt">timestamp_nanos_opt</a></li><li><a href="#method.timestamp_subsec_micros" title="timestamp_subsec_micros">timestamp_subsec_micros</a></li><li><a href="#method.timestamp_subsec_millis" title="timestamp_subsec_millis">timestamp_subsec_millis</a></li><li><a href="#method.timestamp_subsec_nanos" title="timestamp_subsec_nanos">timestamp_subsec_nanos</a></li><li><a href="#method.timezone" title="timezone">timezone</a></li><li><a href="#method.to_rfc2822" title="to_rfc2822">to_rfc2822</a></li><li><a href="#method.to_rfc3339" title="to_rfc3339">to_rfc3339</a></li><li><a href="#method.to_rfc3339_opts" title="to_rfc3339_opts">to_rfc3339_opts</a></li><li><a href="#method.to_utc" title="to_utc">to_utc</a></li><li><a href="#method.with_time" title="with_time">with_time</a></li><li><a href="#method.with_timezone" title="with_timezone">with_timezone</a></li><li><a href="#method.years_since" title="years_since">years_since</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block trait-implementation"><li><a href="#impl-Add%3CDays%3E-for-DateTime%3CTz%3E" title="Add<Days>">Add<Days></a></li><li><a href="#impl-Add%3CDuration%3E-for-DateTime%3CTz%3E" title="Add<Duration>">Add<Duration></a></li><li><a href="#impl-Add%3CFixedOffset%3E-for-DateTime%3CTz%3E" title="Add<FixedOffset>">Add<FixedOffset></a></li><li><a href="#impl-Add%3CMonths%3E-for-DateTime%3CTz%3E" title="Add<Months>">Add<Months></a></li><li><a href="#impl-Add%3CTimeDelta%3E-for-DateTime%3CTz%3E" title="Add<TimeDelta>">Add<TimeDelta></a></li><li><a href="#impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E" title="AddAssign<Duration>">AddAssign<Duration></a></li><li><a href="#impl-AddAssign%3CTimeDelta%3E-for-DateTime%3CTz%3E" title="AddAssign<TimeDelta>">AddAssign<TimeDelta></a></li><li><a href="#impl-Clone-for-DateTime%3CTz%3E" title="Clone">Clone</a></li><li><a href="#impl-Copy-for-DateTime%3CTz%3E" title="Copy">Copy</a></li><li><a href="#impl-Datelike-for-DateTime%3CTz%3E" title="Datelike">Datelike</a></li><li><a href="#impl-Debug-for-DateTime%3CTz%3E" title="Debug">Debug</a></li><li><a href="#impl-Default-for-DateTime%3CFixedOffset%3E" title="Default">Default</a></li><li><a href="#impl-Default-for-DateTime%3CLocal%3E" title="Default">Default</a></li><li><a href="#impl-Default-for-DateTime%3CUtc%3E" title="Default">Default</a></li><li><a href="#impl-Deserialize%3C'de%3E-for-DateTime%3CFixedOffset%3E" title="Deserialize<'de>">Deserialize<'de></a></li><li><a href="#impl-Deserialize%3C'de%3E-for-DateTime%3CLocal%3E" title="Deserialize<'de>">Deserialize<'de></a></li><li><a href="#impl-Deserialize%3C'de%3E-for-DateTime%3CUtc%3E" title="Deserialize<'de>">Deserialize<'de></a></li><li><a href="#impl-Display-for-DateTime%3CTz%3E" title="Display">Display</a></li><li><a href="#impl-DurationRound-for-DateTime%3CTz%3E" title="DurationRound">DurationRound</a></li><li><a href="#impl-Eq-for-DateTime%3CTz%3E" title="Eq">Eq</a></li><li><a href="#impl-From%3CDateTime%3CFixedOffset%3E%3E-for-DateTime%3CLocal%3E" title="From<DateTime<FixedOffset>>">From<DateTime<FixedOffset>></a></li><li><a href="#impl-From%3CDateTime%3CFixedOffset%3E%3E-for-DateTime%3CUtc%3E" title="From<DateTime<FixedOffset>>">From<DateTime<FixedOffset>></a></li><li><a href="#impl-From%3CDateTime%3CLocal%3E%3E-for-DateTime%3CFixedOffset%3E" title="From<DateTime<Local>>">From<DateTime<Local>></a></li><li><a href="#impl-From%3CDateTime%3CLocal%3E%3E-for-DateTime%3CUtc%3E" title="From<DateTime<Local>>">From<DateTime<Local>></a></li><li><a href="#impl-From%3CDateTime%3CTz%3E%3E-for-SystemTime" title="From<DateTime<Tz>>">From<DateTime<Tz>></a></li><li><a href="#impl-From%3CDateTime%3CUtc%3E%3E-for-DateTime%3CFixedOffset%3E" title="From<DateTime<Utc>>">From<DateTime<Utc>></a></li><li><a href="#impl-From%3CDateTime%3CUtc%3E%3E-for-DateTime%3CLocal%3E" title="From<DateTime<Utc>>">From<DateTime<Utc>></a></li><li><a href="#impl-From%3CSystemTime%3E-for-DateTime%3CLocal%3E" title="From<SystemTime>">From<SystemTime></a></li><li><a href="#impl-From%3CSystemTime%3E-for-DateTime%3CUtc%3E" title="From<SystemTime>">From<SystemTime></a></li><li><a href="#impl-FromStr-for-DateTime%3CFixedOffset%3E" title="FromStr">FromStr</a></li><li><a href="#impl-FromStr-for-DateTime%3CLocal%3E" title="FromStr">FromStr</a></li><li><a href="#impl-FromStr-for-DateTime%3CUtc%3E" title="FromStr">FromStr</a></li><li><a href="#impl-Hash-for-DateTime%3CTz%3E" title="Hash">Hash</a></li><li><a href="#impl-Ord-for-DateTime%3CTz%3E" title="Ord">Ord</a></li><li><a href="#impl-PartialEq%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E" title="PartialEq<DateTime<Tz2>>">PartialEq<DateTime<Tz2>></a></li><li><a href="#impl-PartialOrd%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E" title="PartialOrd<DateTime<Tz2>>">PartialOrd<DateTime<Tz2>></a></li><li><a href="#impl-Serialize-for-DateTime%3CTz%3E" title="Serialize">Serialize</a></li><li><a href="#impl-Sub-for-DateTime%3CTz%3E" title="Sub">Sub</a></li><li><a href="#impl-Sub%3C%26DateTime%3CTz%3E%3E-for-DateTime%3CTz%3E" title="Sub<&DateTime<Tz>>">Sub<&DateTime<Tz>></a></li><li><a href="#impl-Sub%3CDays%3E-for-DateTime%3CTz%3E" title="Sub<Days>">Sub<Days></a></li><li><a href="#impl-Sub%3CDuration%3E-for-DateTime%3CTz%3E" title="Sub<Duration>">Sub<Duration></a></li><li><a href="#impl-Sub%3CFixedOffset%3E-for-DateTime%3CTz%3E" title="Sub<FixedOffset>">Sub<FixedOffset></a></li><li><a href="#impl-Sub%3CMonths%3E-for-DateTime%3CTz%3E" title="Sub<Months>">Sub<Months></a></li><li><a href="#impl-Sub%3CTimeDelta%3E-for-DateTime%3CTz%3E" title="Sub<TimeDelta>">Sub<TimeDelta></a></li><li><a href="#impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E" title="SubAssign<Duration>">SubAssign<Duration></a></li><li><a href="#impl-SubAssign%3CTimeDelta%3E-for-DateTime%3CTz%3E" title="SubAssign<TimeDelta>">SubAssign<TimeDelta></a></li><li><a href="#impl-Timelike-for-DateTime%3CTz%3E" title="Timelike">Timelike</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block synthetic-implementation"><li><a href="#impl-Freeze-for-DateTime%3CTz%3E" title="Freeze">Freeze</a></li><li><a href="#impl-RefUnwindSafe-for-DateTime%3CTz%3E" title="RefUnwindSafe">RefUnwindSafe</a></li><li><a href="#impl-Send-for-DateTime%3CTz%3E" title="Send">Send</a></li><li><a href="#impl-Sync-for-DateTime%3CTz%3E" title="Sync">Sync</a></li><li><a href="#impl-Unpin-for-DateTime%3CTz%3E" title="Unpin">Unpin</a></li><li><a href="#impl-UnwindSafe-for-DateTime%3CTz%3E" title="UnwindSafe">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block blanket-implementation"><li><a href="#impl-Any-for-T" title="Any">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T" title="Borrow<T>">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T" title="BorrowMut<T>">BorrowMut<T></a></li><li><a href="#impl-CloneToUninit-for-T" title="CloneToUninit">CloneToUninit</a></li><li><a href="#impl-DeserializeOwned-for-T" title="DeserializeOwned">DeserializeOwned</a></li><li><a href="#impl-From%3CT%3E-for-T" title="From<T>">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-T" title="Into<U>">Into<U></a></li><li><a href="#impl-SubsecRound-for-T" title="SubsecRound">SubsecRound</a></li><li><a href="#impl-ToOwned-for-T" title="ToOwned">ToOwned</a></li><li><a href="#impl-ToString-for-T" title="ToString">ToString</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T" title="TryFrom<U>">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-T" title="TryInto<U>">TryInto<U></a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate chrono</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">chrono</a></span><h1>Struct <span class="struct">DateTime</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/chrono/datetime/mod.rs.html#56-59">Source</a> </span></div><pre class="rust item-decl"><code>pub struct DateTime<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> {
datetime: <a class="struct" href="struct.NaiveDateTime.html" title="struct chrono::NaiveDateTime">NaiveDateTime</a>,
offset: Tz::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>,
}</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="fields" class="fields section-header">Fields<a href="#fields" class="anchor">§</a></h2><span id="structfield.datetime" class="structfield section-header"><a href="#structfield.datetime" class="anchor field">§</a><code>datetime: <a class="struct" href="struct.NaiveDateTime.html" title="struct chrono::NaiveDateTime">NaiveDateTime</a></code></span><span id="structfield.offset" class="structfield section-header"><a href="#structfield.offset" class="anchor field">§</a><code>offset: Tz::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a></code></span><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#68-713">Source</a><a href="#impl-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedconstant.MIN_UTC" class="associatedconstant"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#710">Source</a><h4 class="code-header">pub const <a href="#associatedconstant.MIN_UTC" class="constant">MIN_UTC</a>: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>></h4></section></summary><div class="docblock"><p>The minimum possible <code>DateTime<Utc></code>.</p>
</div></details><details class="toggle" open><summary><section id="associatedconstant.MAX_UTC" class="associatedconstant"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#712">Source</a><h4 class="code-header">pub const <a href="#associatedconstant.MAX_UTC" class="constant">MAX_UTC</a>: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>></h4></section></summary><div class="docblock"><p>The maximum possible <code>DateTime<Utc></code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_naive_utc_and_offset" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#94-99">Source</a><h4 class="code-header">pub const fn <a href="#method.from_naive_utc_and_offset" class="fn">from_naive_utc_and_offset</a>(
datetime: <a class="struct" href="struct.NaiveDateTime.html" title="struct chrono::NaiveDateTime">NaiveDateTime</a>,
offset: Tz::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>,
) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> from its components: a <code>NaiveDateTime</code> in UTC and an <code>Offset</code>.</p>
<p>This is a low-level method, intended for use cases such as deserializing a <code>DateTime</code> or
passing it through FFI.</p>
<p>For regular use you will probably want to use a method such as
<a href="trait.TimeZone.html#method.from_local_datetime" title="method chrono::TimeZone::from_local_datetime"><code>TimeZone::from_local_datetime</code></a> or <a href="struct.NaiveDateTime.html#method.and_local_timezone" title="method chrono::NaiveDateTime::and_local_timezone"><code>NaiveDateTime::and_local_timezone</code></a> instead.</p>
<h5 id="example"><a class="doc-anchor" href="#example">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{DateTime, Local};
<span class="kw">let </span>dt = Local::now();
<span class="comment">// Get components
</span><span class="kw">let </span>naive_utc = dt.naive_utc();
<span class="kw">let </span>offset = dt.offset().clone();
<span class="comment">// Serialize, pass through FFI... and recreate the `DateTime`:
</span><span class="kw">let </span>dt_new = DateTime::<Local>::from_naive_utc_and_offset(naive_utc, offset);
<span class="macro">assert_eq!</span>(dt, dt_new);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_utc" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#108-110">Source</a><h4 class="code-header">pub fn <a href="#method.from_utc" class="fn">from_utc</a>(datetime: <a class="struct" href="struct.NaiveDateTime.html" title="struct chrono::NaiveDateTime">NaiveDateTime</a>, offset: Tz::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.4.27: Use TimeZone::from_utc_datetime() or DateTime::from_naive_utc_and_offset instead</span></div></span></summary><div class="docblock"><p>Makes a new <code>DateTime</code> from its components: a <code>NaiveDateTime</code> in UTC and an <code>Offset</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_local" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#126-130">Source</a><h4 class="code-header">pub fn <a href="#method.from_local" class="fn">from_local</a>(datetime: <a class="struct" href="struct.NaiveDateTime.html" title="struct chrono::NaiveDateTime">NaiveDateTime</a>, offset: Tz::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.4.27: Use TimeZone::from_local_datetime() or NaiveDateTime::and_local_timezone instead</span></div></span></summary><div class="docblock"><p>Makes a new <code>DateTime</code> from a <code>NaiveDateTime</code> in <em>local</em> time and an <code>Offset</code>.</p>
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
<p>Panics if the local datetime can’t be converted to UTC because it would be out of range.</p>
<p>This can happen if <code>datetime</code> is near the end of the representable range of <code>NaiveDateTime</code>,
and the offset from UTC pushes it beyond that.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.date" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#149-151">Source</a><h4 class="code-header">pub fn <a href="#method.date" class="fn">date</a>(&self) -> <a class="struct" href="struct.Date.html" title="struct chrono::Date">Date</a><Tz></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 0.4.23: Use <code>date_naive()</code> instead</span></div></span></summary><div class="docblock"><p>Retrieves the date component with an associated timezone.</p>
<p>Unless you are immediately planning on turning this into a <code>DateTime</code>
with the same timezone you should use the <a href="struct.DateTime.html#method.date_naive" title="method chrono::DateTime::date_naive"><code>date_naive</code></a> method.</p>
<p><a href="struct.NaiveDate.html" title="struct chrono::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 class="doc-anchor" href="#panics-1">§</a>Panics</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="struct.NaiveDateTime.html" title="struct chrono::NaiveDateTime"><code>NaiveDateTime</code></a>. This
method will panic if the offset from UTC would push the local date outside of the
representable range of a <a href="struct.Date.html" title="struct chrono::Date"><code>Date</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.date_naive" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#173-175">Source</a><h4 class="code-header">pub fn <a href="#method.date_naive" class="fn">date_naive</a>(&self) -> <a class="struct" href="struct.NaiveDate.html" title="struct chrono::NaiveDate">NaiveDate</a></h4></section></summary><div class="docblock"><p>Retrieves the date component.</p>
<h5 id="panics-2"><a class="doc-anchor" href="#panics-2">§</a>Panics</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="struct.NaiveDateTime.html" title="struct chrono::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.NaiveDate.html" title="struct chrono::NaiveDate"><code>NaiveDate</code></a>.</p>
<h5 id="example-1"><a class="doc-anchor" href="#example-1">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::prelude::<span class="kw-2">*</span>;
<span class="kw">let </span>date: DateTime<Utc> = Utc.with_ymd_and_hms(<span class="number">2020</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).unwrap();
<span class="kw">let </span>other: DateTime<FixedOffset> =
FixedOffset::east_opt(<span class="number">23</span>).unwrap().with_ymd_and_hms(<span class="number">2020</span>, <span class="number">1</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).unwrap();
<span class="macro">assert_eq!</span>(date.date_naive(), other.date_naive());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.time" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#180-182">Source</a><h4 class="code-header">pub fn <a href="#method.time" class="fn">time</a>(&self) -> <a class="struct" href="struct.NaiveTime.html" title="struct chrono::NaiveTime">NaiveTime</a></h4></section></summary><div class="docblock"><p>Retrieves the time component.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#200-204">Source</a><h4 class="code-header">pub const fn <a href="#method.timestamp" class="fn">timestamp</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.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="trait.TimeZone.html#method.timestamp_opt" title="method chrono::TimeZone::timestamp_opt"><code>TimeZone::timestamp_opt</code></a>.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{DateTime, TimeZone, Utc};
<span class="kw">let </span>dt: DateTime<Utc> = Utc.with_ymd_and_hms(<span class="number">2015</span>, <span class="number">5</span>, <span class="number">15</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).unwrap();
<span class="macro">assert_eq!</span>(dt.timestamp(), <span class="number">1431648000</span>);
<span class="macro">assert_eq!</span>(DateTime::from_timestamp(dt.timestamp(), dt.timestamp_subsec_nanos()).unwrap(), dt);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_millis" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#231-234">Source</a><h4 class="code-header">pub const fn <a href="#method.timestamp_millis" class="fn">timestamp_millis</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.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 class="doc-anchor" href="#example-2">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{NaiveDate, Utc};
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">1970</span>, <span class="number">1</span>, <span class="number">1</span>)
.unwrap()
.and_hms_milli_opt(<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">444</span>)
.unwrap()
.and_local_timezone(Utc)
.unwrap();
<span class="macro">assert_eq!</span>(dt.timestamp_millis(), <span class="number">1_444</span>);
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">2001</span>, <span class="number">9</span>, <span class="number">9</span>)
.unwrap()
.and_hms_milli_opt(<span class="number">1</span>, <span class="number">46</span>, <span class="number">40</span>, <span class="number">555</span>)
.unwrap()
.and_local_timezone(Utc)
.unwrap();
<span class="macro">assert_eq!</span>(dt.timestamp_millis(), <span class="number">1_000_000_000_555</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_micros" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#261-264">Source</a><h4 class="code-header">pub const fn <a href="#method.timestamp_micros" class="fn">timestamp_micros</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.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 class="doc-anchor" href="#example-3">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{NaiveDate, Utc};
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">1970</span>, <span class="number">1</span>, <span class="number">1</span>)
.unwrap()
.and_hms_micro_opt(<span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>, <span class="number">444</span>)
.unwrap()
.and_local_timezone(Utc)
.unwrap();
<span class="macro">assert_eq!</span>(dt.timestamp_micros(), <span class="number">1_000_444</span>);
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">2001</span>, <span class="number">9</span>, <span class="number">9</span>)
.unwrap()
.and_hms_micro_opt(<span class="number">1</span>, <span class="number">46</span>, <span class="number">40</span>, <span class="number">555</span>)
.unwrap()
.and_local_timezone(Utc)
.unwrap();
<span class="macro">assert_eq!</span>(dt.timestamp_micros(), <span class="number">1_000_000_000_000_555</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_nanos" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#278-283">Source</a><h4 class="code-header">pub const fn <a href="#method.timestamp_nanos" class="fn">timestamp_nanos</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.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 class="doc-anchor" href="#panics-3">§</a>Panics</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:43.145224192
and 2262-04-11T23:47:16.854775807.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_nanos_opt" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#350-364">Source</a><h4 class="code-header">pub const fn <a href="#method.timestamp_nanos_opt" class="fn">timestamp_nanos_opt</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.i64.html">i64</a>></h4></section></summary><div class="docblock"><p>Returns the number of non-leap-nanoseconds since January 1, 1970 UTC.</p>
<h5 id="errors"><a class="doc-anchor" href="#errors">§</a>Errors</h5>
<p>An <code>i64</code> with nanosecond precision can span a range of ~584 years. This function returns
<code>None</code> on an out of range <code>DateTime</code>.</p>
<p>The dates that can be represented as nanoseconds are between 1677-09-21T00:12:43.145224192
and 2262-04-11T23:47:16.854775807.</p>
<h5 id="example-4"><a class="doc-anchor" href="#example-4">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{NaiveDate, Utc};
<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>));
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">1677</span>, <span class="number">9</span>, <span class="number">21</span>)
.unwrap()
.and_hms_nano_opt(<span class="number">0</span>, <span class="number">12</span>, <span class="number">43</span>, <span class="number">145_224_192</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">9_223_372_036_854_775_808</span>));
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">2262</span>, <span class="number">4</span>, <span class="number">11</span>)
.unwrap()
.and_hms_nano_opt(<span class="number">23</span>, <span class="number">47</span>, <span class="number">16</span>, <span class="number">854_775_807</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">9_223_372_036_854_775_807</span>));
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">1677</span>, <span class="number">9</span>, <span class="number">21</span>)
.unwrap()
.and_hms_nano_opt(<span class="number">0</span>, <span class="number">12</span>, <span class="number">43</span>, <span class="number">145_224_191</span>)
.unwrap()
.and_local_timezone(Utc)
.unwrap();
<span class="macro">assert_eq!</span>(dt.timestamp_nanos_opt(), <span class="prelude-val">None</span>);
<span class="kw">let </span>dt = NaiveDate::from_ymd_opt(<span class="number">2262</span>, <span class="number">4</span>, <span class="number">11</span>)
.unwrap()
.and_hms_nano_opt(<span class="number">23</span>, <span class="number">47</span>, <span class="number">16</span>, <span class="number">854_775_808</span>)
.unwrap()
.and_local_timezone(Utc)
.unwrap();
<span class="macro">assert_eq!</span>(dt.timestamp_nanos_opt(), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_subsec_millis" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#371-373">Source</a><h4 class="code-header">pub const fn <a href="#method.timestamp_subsec_millis" class="fn">timestamp_subsec_millis</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Returns the number of milliseconds since the last second boundary.</p>
<p>In event of a leap second this may exceed 999.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_subsec_micros" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#380-382">Source</a><h4 class="code-header">pub const fn <a href="#method.timestamp_subsec_micros" class="fn">timestamp_subsec_micros</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Returns the number of microseconds since the last second boundary.</p>
<p>In event of a leap second this may exceed 999,999.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.timestamp_subsec_nanos" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#389-391">Source</a><h4 class="code-header">pub const fn <a href="#method.timestamp_subsec_nanos" class="fn">timestamp_subsec_nanos</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class="docblock"><p>Returns the number of nanoseconds since the last second boundary</p>
<p>In event of a leap second this may exceed 999,999,999.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.offset" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#396-398">Source</a><h4 class="code-header">pub const fn <a href="#method.offset" class="fn">offset</a>(&self) -> &Tz::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a></h4></section></summary><div class="docblock"><p>Retrieves an associated offset from UTC.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.timezone" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#403-405">Source</a><h4 class="code-header">pub fn <a href="#method.timezone" class="fn">timezone</a>(&self) -> Tz</h4></section></summary><div class="docblock"><p>Retrieves an associated time zone.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_timezone" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#412-414">Source</a><h4 class="code-header">pub fn <a href="#method.with_timezone" class="fn">with_timezone</a><Tz2: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>>(&self, tz: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.reference.html">&Tz2</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz2></h4></section></summary><div class="docblock"><p>Changes the associated time zone.
The returned <code>DateTime</code> references the same instant of time from the perspective of the
provided time zone.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.fixed_offset" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#420-422">Source</a><h4 class="code-header">pub fn <a href="#method.fixed_offset" class="fn">fixed_offset</a>(&self) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>></h4></section></summary><div class="docblock"><p>Fix the offset from UTC to its current value, dropping the associated timezone information.
This it useful for converting a generic <code>DateTime<Tz: Timezone></code> to <code>DateTime<FixedOffset></code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_utc" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#428-430">Source</a><h4 class="code-header">pub const fn <a href="#method.to_utc" class="fn">to_utc</a>(&self) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>></h4></section></summary><div class="docblock"><p>Turn this <code>DateTime</code> into a <code>DateTime<Utc></code>, dropping the offset and associated timezone
information.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_add_signed" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#439-443">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.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Adds given <code>TimeDelta</code> to the current date and time.</p>
<h5 id="errors-1"><a class="doc-anchor" href="#errors-1">§</a>Errors</h5>
<p>Returns <code>None</code> if the resulting date would be out of range.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_add_months" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#459-467">Source</a><h4 class="code-header">pub fn <a href="#method.checked_add_months" class="fn">checked_add_months</a>(self, months: <a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Adds given <code>Months</code> to the current date and time.</p>
<p>Uses the last day of the month if the day does not exist in the resulting month.</p>
<p>See <a href="struct.NaiveDate.html#method.checked_add_months" title="method chrono::NaiveDate::checked_add_months"><code>NaiveDate::checked_add_months</code></a> for more details on behavior.</p>
<h5 id="errors-2"><a class="doc-anchor" href="#errors-2">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
<li>The resulting UTC datetime would be out of range.</li>
<li>The resulting local datetime would be out of range (unless <code>months</code> is zero).</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_sub_signed" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#476-480">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.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Subtracts given <code>TimeDelta</code> from the current date and time.</p>
<h5 id="errors-3"><a class="doc-anchor" href="#errors-3">§</a>Errors</h5>
<p>Returns <code>None</code> if the resulting date would be out of range.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_sub_months" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#496-504">Source</a><h4 class="code-header">pub fn <a href="#method.checked_sub_months" class="fn">checked_sub_months</a>(self, months: <a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Subtracts given <code>Months</code> from the current date and time.</p>
<p>Uses the last day of the month if the day does not exist in the resulting month.</p>
<p>See <a href="struct.NaiveDate.html#method.checked_sub_months" title="method chrono::NaiveDate::checked_sub_months"><code>NaiveDate::checked_sub_months</code></a> for more details on behavior.</p>
<h5 id="errors-4"><a class="doc-anchor" href="#errors-4">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
<li>The resulting UTC datetime would be out of range.</li>
<li>The resulting local datetime would be out of range (unless <code>months</code> is zero).</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_add_days" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#516-527">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="struct.Days.html" title="struct chrono::Days">Days</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></h4></section></summary><div class="docblock"><p>Add a duration in <a href="struct.Days.html" title="struct chrono::Days"><code>Days</code></a> to the date part of the <code>DateTime</code>.</p>
<h5 id="errors-5"><a class="doc-anchor" href="#errors-5">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
<li>The resulting UTC datetime would be out of range.</li>
<li>The resulting local datetime would be out of range (unless <code>days</code> is zero).</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.checked_sub_days" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#539-547">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="struct.Days.html" title="struct chrono::Days">Days</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></h4></section></summary><div class="docblock"><p>Subtract a duration in <a href="struct.Days.html" title="struct chrono::Days"><code>Days</code></a> from the date part of the <code>DateTime</code>.</p>
<h5 id="errors-6"><a class="doc-anchor" href="#errors-6">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
<li>The resulting UTC datetime would be out of range.</li>
<li>The resulting local datetime would be out of range (unless <code>days</code> is zero).</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.signed_duration_since" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#553-558">Source</a><h4 class="code-header">pub fn <a href="#method.signed_duration_since" class="fn">signed_duration_since</a><Tz2: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>>(
self,
rhs: impl <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz2>>,
) -> <a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a></h4></section></summary><div class="docblock"><p>Subtracts another <code>DateTime</code> from the current date and time.
This does not overflow or underflow at all.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.naive_utc" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#563-565">Source</a><h4 class="code-header">pub const fn <a href="#method.naive_utc" class="fn">naive_utc</a>(&self) -> <a class="struct" href="struct.NaiveDateTime.html" title="struct chrono::NaiveDateTime">NaiveDateTime</a></h4></section></summary><div class="docblock"><p>Returns a view to the naive UTC datetime.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.naive_local" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#576-580">Source</a><h4 class="code-header">pub fn <a href="#method.naive_local" class="fn">naive_local</a>(&self) -> <a class="struct" href="struct.NaiveDateTime.html" title="struct chrono::NaiveDateTime">NaiveDateTime</a></h4></section></summary><div class="docblock"><p>Returns a view to the naive local datetime.</p>
<h5 id="panics-4"><a class="doc-anchor" href="#panics-4">§</a>Panics</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="struct.NaiveDateTime.html" title="struct chrono::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="struct.NaiveDateTime.html" title="struct chrono::NaiveDateTime"><code>NaiveDateTime</code></a>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.overflowing_naive_local" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#589-591">Source</a><h4 class="code-header">pub(crate) fn <a href="#method.overflowing_naive_local" class="fn">overflowing_naive_local</a>(&self) -> <a class="struct" href="struct.NaiveDateTime.html" title="struct chrono::NaiveDateTime">NaiveDateTime</a></h4></section></summary><div class="docblock"><p>Returns the naive local datetime.</p>
<p>This makes use of the buffer space outside of the representable range of values of
<code>NaiveDateTime</code>. The result can be used as intermediate value, but should never be exposed
outside chrono.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.years_since" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#599-613">Source</a><h4 class="code-header">pub fn <a href="#method.years_since" class="fn">years_since</a>(&self, base: Self) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>></h4></section></summary><div class="docblock"><p>Retrieve the elapsed years from now to the given <a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a>.</p>
<h5 id="errors-7"><a class="doc-anchor" href="#errors-7">§</a>Errors</h5>
<p>Returns <code>None</code> if <code>base > self</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_rfc2822" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#623-628">Source</a><h4 class="code-header">pub fn <a href="#method.to_rfc2822" class="fn">to_rfc2822</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.85.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-5"><a class="doc-anchor" href="#panics-5">§</a>Panics</h5>
<p>Panics if the date can not be represented in this format: the year may not be negative and
can not have more than 4 digits.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_rfc3339" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#633-641">Source</a><h4 class="code-header">pub fn <a href="#method.to_rfc3339" class="fn">to_rfc3339</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.85.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class="docblock"><p>Returns an RFC 3339 and ISO 8601 date and time string such as <code>1996-12-19T16:39:57-08:00</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.to_rfc3339_opts" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#676-681">Source</a><h4 class="code-header">pub fn <a href="#method.to_rfc3339_opts" class="fn">to_rfc3339_opts</a>(&self, secform: <a class="enum" href="format/enum.SecondsFormat.html" title="enum chrono::format::SecondsFormat">SecondsFormat</a>, use_z: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.bool.html">bool</a>) -> <a class="struct" href="https://doc.rust-lang.org/1.85.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 class="doc-anchor" href="#examples">§</a>Examples</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_utc();
<span class="macro">assert_eq!</span>(dt.to_rfc3339_opts(SecondsFormat::Millis, <span class="bool-val">false</span>), <span class="string">"2018-01-26T18:30:09.453+00:00"</span>);
<span class="macro">assert_eq!</span>(dt.to_rfc3339_opts(SecondsFormat::Millis, <span class="bool-val">true</span>), <span class="string">"2018-01-26T18:30:09.453Z"</span>);
<span class="macro">assert_eq!</span>(dt.to_rfc3339_opts(SecondsFormat::Secs, <span class="bool-val">true</span>), <span class="string">"2018-01-26T18:30:09Z"</span>);
<span class="kw">let </span>pst = FixedOffset::east_opt(<span class="number">8 </span>* <span class="number">60 </span>* <span class="number">60</span>).unwrap();
<span class="kw">let </span>dt = pst
.from_local_datetime(
<span class="kw-2">&</span>NaiveDate::from_ymd_opt(<span class="number">2018</span>, <span class="number">1</span>, <span class="number">26</span>)
.unwrap()
.and_hms_micro_opt(<span class="number">10</span>, <span class="number">30</span>, <span class="number">9</span>, <span class="number">453_829</span>)
.unwrap(),
)
.unwrap();
<span class="macro">assert_eq!</span>(dt.to_rfc3339_opts(SecondsFormat::Secs, <span class="bool-val">true</span>), <span class="string">"2018-01-26T10:30:09+08:00"</span>);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_time" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#705-707">Source</a><h4 class="code-header">pub fn <a href="#method.with_time" class="fn">with_time</a>(&self, time: <a class="struct" href="struct.NaiveTime.html" title="struct chrono::NaiveTime">NaiveTime</a>) -> <a class="enum" href="offset/enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><Self></h4></section></summary><div class="docblock"><p>Set the time to a new fixed time on the existing date.</p>
<h5 id="errors-8"><a class="doc-anchor" href="#errors-8">§</a>Errors</h5>
<p>Returns <code>LocalResult::None</code> if the datetime is at the edge of the representable range for a
<code>DateTime</code>, and <code>with_time</code> would push the value in UTC out of range.</p>
<h5 id="example-5"><a class="doc-anchor" href="#example-5">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{Local, NaiveTime};
<span class="kw">let </span>noon = NaiveTime::from_hms_opt(<span class="number">12</span>, <span class="number">0</span>, <span class="number">0</span>).unwrap();
<span class="kw">let </span>today_noon = Local::now().with_time(noon);
<span class="kw">let </span>today_midnight = Local::now().with_time(NaiveTime::MIN);
<span class="macro">assert_eq!</span>(today_noon.single().unwrap().time(), noon);
<span class="macro">assert_eq!</span>(today_midnight.single().unwrap().time(), NaiveTime::MIN);</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#715-862">Source</a><a href="#impl-DateTime%3CUtc%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedconstant.UNIX_EPOCH" class="associatedconstant"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#861">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><details class="toggle method-toggle" open><summary><section id="method.from_timestamp" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#747-756">Source</a><h4 class="code-header">pub const fn <a href="#method.from_timestamp" class="fn">from_timestamp</a>(secs: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.i64.html">i64</a>, nsecs: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime<Utc></code> 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="trait.TimeZone.html" title="trait chrono::TimeZone"><code>TimeZone</code></a> different from <a href="struct.Utc.html" title="struct chrono::Utc"><code>Utc</code></a>, use
<a href="trait.TimeZone.html#method.timestamp_opt" title="method chrono::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="struct.NaiveTime.html#leap-second-handling" title="struct chrono::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-9"><a class="doc-anchor" href="#errors-9">§</a>Errors</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-6"><a class="doc-anchor" href="#example-6">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::DateTime;
<span class="kw">let </span>dt = DateTime::from_timestamp(<span class="number">1431648000</span>, <span class="number">0</span>).expect(<span class="string">"invalid timestamp"</span>);
<span class="macro">assert_eq!</span>(dt.to_string(), <span class="string">"2015-05-15 00:00:00 UTC"</span>);
<span class="macro">assert_eq!</span>(DateTime::from_timestamp(dt.timestamp(), dt.timestamp_subsec_nanos()).unwrap(), dt);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_timestamp_millis" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#782-786">Source</a><h4 class="code-header">pub const fn <a href="#method.from_timestamp_millis" class="fn">from_timestamp_millis</a>(millis: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.i64.html">i64</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime<Utc></code> from the number of non-leap milliseconds
since January 1, 1970 0:00:00.000 UTC (aka “UNIX timestamp”).</p>
<p>This is guaranteed to round-trip with <a href="struct.DateTime.html#method.timestamp_millis" title="method chrono::DateTime::timestamp_millis"><code>timestamp_millis</code></a>.</p>
<p>If you need to create a <code>DateTime</code> with a <a href="trait.TimeZone.html" title="trait chrono::TimeZone"><code>TimeZone</code></a> different from <a href="struct.Utc.html" title="struct chrono::Utc"><code>Utc</code></a>, use
<a href="trait.TimeZone.html#method.timestamp_millis_opt" title="method chrono::TimeZone::timestamp_millis_opt"><code>TimeZone::timestamp_millis_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>
<h5 id="errors-10"><a class="doc-anchor" href="#errors-10">§</a>Errors</h5>
<p>Returns <code>None</code> on out-of-range number of milliseconds, otherwise returns <code>Some(DateTime {...})</code>.</p>
<h5 id="example-7"><a class="doc-anchor" href="#example-7">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::DateTime;
<span class="kw">let </span>dt = DateTime::from_timestamp_millis(<span class="number">947638923004</span>).expect(<span class="string">"invalid timestamp"</span>);
<span class="macro">assert_eq!</span>(dt.to_string(), <span class="string">"2000-01-12 01:02:03.004 UTC"</span>);
<span class="macro">assert_eq!</span>(DateTime::from_timestamp_millis(dt.timestamp_millis()).unwrap(), dt);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_timestamp_micros" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#819-823">Source</a><h4 class="code-header">pub const fn <a href="#method.from_timestamp_micros" class="fn">from_timestamp_micros</a>(micros: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.i64.html">i64</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><Self></h4></section></summary><div class="docblock"><p>Creates a new <code>DateTime<Utc></code> from the number of non-leap microseconds
since January 1, 1970 0:00:00.000 UTC (aka “UNIX timestamp”).</p>
<p>This is guaranteed to round-trip with <a href="struct.DateTime.html#method.timestamp_micros" title="method chrono::DateTime::timestamp_micros"><code>timestamp_micros</code></a>.</p>
<p>If you need to create a <code>DateTime</code> with a <a href="trait.TimeZone.html" title="trait chrono::TimeZone"><code>TimeZone</code></a> different from <a href="struct.Utc.html" title="struct chrono::Utc"><code>Utc</code></a>, use
<a href="trait.TimeZone.html#method.timestamp_micros" title="method chrono::TimeZone::timestamp_micros"><code>TimeZone::timestamp_micros</code></a> or <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>.</p>
<h5 id="errors-11"><a class="doc-anchor" href="#errors-11">§</a>Errors</h5>
<p>Returns <code>None</code> if the number of microseconds would be out of range for a <code>NaiveDateTime</code>
(more than ca. 262,000 years away from common era)</p>
<h5 id="example-8"><a class="doc-anchor" href="#example-8">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::DateTime;
<span class="kw">let </span>timestamp_micros: i64 = <span class="number">1662921288000000</span>; <span class="comment">// Sun, 11 Sep 2022 18:34:48 UTC
</span><span class="kw">let </span>dt = DateTime::from_timestamp_micros(timestamp_micros);
<span class="macro">assert!</span>(dt.is_some());
<span class="macro">assert_eq!</span>(timestamp_micros, dt.expect(<span class="string">"invalid timestamp"</span>).timestamp_micros());
<span class="comment">// Negative timestamps (before the UNIX epoch) are supported as well.
</span><span class="kw">let </span>timestamp_micros: i64 = -<span class="number">2208936075000000</span>; <span class="comment">// Mon, 1 Jan 1900 14:38:45 UTC
</span><span class="kw">let </span>dt = DateTime::from_timestamp_micros(timestamp_micros);
<span class="macro">assert!</span>(dt.is_some());
<span class="macro">assert_eq!</span>(timestamp_micros, dt.expect(<span class="string">"invalid timestamp"</span>).timestamp_micros());</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.from_timestamp_nanos" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#854-858">Source</a><h4 class="code-header">pub const fn <a href="#method.from_timestamp_nanos" class="fn">from_timestamp_nanos</a>(nanos: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.i64.html">i64</a>) -> Self</h4></section></summary><div class="docblock"><p>Creates a new <a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime<Utc></code></a> from the number of non-leap nanoseconds
since January 1, 1970 0:00:00.000 UTC (aka “UNIX timestamp”).</p>
<p>This is guaranteed to round-trip with <a href="struct.DateTime.html#method.timestamp_nanos" title="method chrono::DateTime::timestamp_nanos"><code>timestamp_nanos</code></a>.</p>
<p>If you need to create a <code>DateTime</code> with a <a href="trait.TimeZone.html" title="trait chrono::TimeZone"><code>TimeZone</code></a> different from <a href="struct.Utc.html" title="struct chrono::Utc"><code>Utc</code></a>, use
<a href="trait.TimeZone.html#method.timestamp_nanos" title="method chrono::TimeZone::timestamp_nanos"><code>TimeZone::timestamp_nanos</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 UNIX epoch starts on midnight, January 1, 1970, UTC.</p>
<p>An <code>i64</code> with nanosecond precision can span a range of ~584 years. Because all values can
be represented as a <code>DateTime</code> this method never fails.</p>
<h5 id="example-9"><a class="doc-anchor" href="#example-9">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::DateTime;
<span class="kw">let </span>timestamp_nanos: i64 = <span class="number">1662921288_000_000_000</span>; <span class="comment">// Sun, 11 Sep 2022 18:34:48 UTC
</span><span class="kw">let </span>dt = DateTime::from_timestamp_nanos(timestamp_nanos);
<span class="macro">assert_eq!</span>(timestamp_nanos, dt.timestamp_nanos_opt().unwrap());
<span class="comment">// Negative timestamps (before the UNIX epoch) are supported as well.
</span><span class="kw">let </span>timestamp_nanos: i64 = -<span class="number">2208936075_000_000_000</span>; <span class="comment">// Mon, 1 Jan 1900 14:38:45 UTC
</span><span class="kw">let </span>dt = DateTime::from_timestamp_nanos(timestamp_nanos);
<span class="macro">assert_eq!</span>(timestamp_nanos, dt.timestamp_nanos_opt().unwrap());</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-DateTime%3CFixedOffset%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#961-1094">Source</a><a href="#impl-DateTime%3CFixedOffset%3E" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.parse_from_rfc2822" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#994-999">Source</a><h4 class="code-header">pub fn <a href="#method.parse_from_rfc2822" class="fn">parse_from_rfc2822</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.str.html">str</a>) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>>></h4></section></summary><div class="docblock"><p>Parses an RFC 2822 date-and-time string into a <code>DateTime<FixedOffset></code> value.</p>
<p>This parses valid RFC 2822 datetime strings (such as <code>Tue, 1 Jul 2003 10:52:37 +0200</code>)
and returns a new <a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a> instance with the parsed timezone as the <a href="struct.FixedOffset.html" title="struct chrono::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 class="doc-anchor" href="#support-for-the-obsolete-date-format">§</a>Support for the obsolete date format</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-10"><a class="doc-anchor" href="#example-10">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="macro">assert_eq!</span>(
DateTime::parse_from_rfc2822(<span class="string">"Wed, 18 Feb 2015 23:16:09 GMT"</span>).unwrap(),
FixedOffset::east_opt(<span class="number">0</span>).unwrap().with_ymd_and_hms(<span class="number">2015</span>, <span class="number">2</span>, <span class="number">18</span>, <span class="number">23</span>, <span class="number">16</span>, <span class="number">9</span>).unwrap()
);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_from_rfc3339" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1014-1021">Source</a><h4 class="code-header">pub fn <a href="#method.parse_from_rfc3339" class="fn">parse_from_rfc3339</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.str.html">str</a>) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>>></h4></section></summary><div class="docblock"><p>Parses an RFC 3339 date-and-time string into a <code>DateTime<FixedOffset></code> value.</p>
<p>Parses all valid RFC 3339 values (as well as the subset of valid ISO 8601 values that are
also valid RFC 3339 date-and-time values) and returns a new <a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a> with a
<a href="struct.FixedOffset.html" title="struct chrono::FixedOffset"><code>FixedOffset</code></a> corresponding to the parsed timezone. While RFC 3339 values come in a wide
variety of shapes and sizes, <code>1996-12-19T16:39:57-08:00</code> is an example of the most commonly
encountered variety of RFC 3339 formats.</p>
<p>Why isn’t this named <code>parse_from_iso8601</code>? That’s because ISO 8601 allows representing
values in a wide range of formats, only some of which represent actual date-and-time
instances (rather than periods, ranges, dates, or times). Some valid ISO 8601 values are
also simultaneously valid RFC 3339 values, but not all RFC 3339 values are valid ISO 8601
values (or the other way around).</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_from_str" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1052-1056">Source</a><h4 class="code-header">pub fn <a href="#method.parse_from_str" class="fn">parse_from_str</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.str.html">str</a>, fmt: &<a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.str.html">str</a>) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>>></h4></section></summary><div class="docblock"><p>Parses a string from a user-specified format into a <code>DateTime<FixedOffset></code> value.</p>
<p>Note that this method <em>requires a timezone</em> in the input string. See
<a href="./naive/struct.NaiveDateTime.html#method.parse_from_str"><code>NaiveDateTime::parse_from_str</code></a>
for a version that does not require a timezone in the to-be-parsed str. The returned
<a href="struct.DateTime.html" title="struct chrono::DateTime"><code>DateTime</code></a> value will have a <a href="struct.FixedOffset.html" title="struct chrono::FixedOffset"><code>FixedOffset</code></a> reflecting the parsed timezone.</p>
<p>See the <a href="format/strftime/index.html" title="mod chrono::format::strftime"><code>format::strftime</code> module</a> for supported format
sequences.</p>
<h5 id="example-11"><a class="doc-anchor" href="#example-11">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::{DateTime, FixedOffset, NaiveDate, TimeZone};
<span class="kw">let </span>dt = DateTime::parse_from_str(<span class="string">"1983 Apr 13 12:09:14.274 +0000"</span>, <span class="string">"%Y %b %d %H:%M:%S%.3f %z"</span>);
<span class="macro">assert_eq!</span>(
dt,
<span class="prelude-val">Ok</span>(FixedOffset::east_opt(<span class="number">0</span>)
.unwrap()
.from_local_datetime(
<span class="kw-2">&</span>NaiveDate::from_ymd_opt(<span class="number">1983</span>, <span class="number">4</span>, <span class="number">13</span>)
.unwrap()
.and_hms_milli_opt(<span class="number">12</span>, <span class="number">9</span>, <span class="number">14</span>, <span class="number">274</span>)
.unwrap()
)
.unwrap())
);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.parse_and_remainder" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1086-1093">Source</a><h4 class="code-header">pub fn <a href="#method.parse_and_remainder" class="fn">parse_and_remainder</a><'a>(
s: &'a <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.str.html">str</a>,
fmt: &<a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.str.html">str</a>,
) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><(<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>>, &'a <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.str.html">str</a>)></h4></section></summary><div class="docblock"><p>Parses a string from a user-specified format into a <code>DateTime<FixedOffset></code> value, and a
slice with the remaining portion of the string.</p>
<p>Note that this method <em>requires a timezone</em> in the input string. See
<a href="struct.NaiveDateTime.html#method.parse_and_remainder" title="associated function chrono::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="struct.FixedOffset.html" title="struct chrono::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-12"><a class="doc-anchor" href="#example-12">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>(datetime, remainder) = DateTime::parse_and_remainder(
<span class="string">"2015-02-18 23:16:09 +0200 trailing text"</span>,
<span class="string">"%Y-%m-%d %H:%M:%S %z"</span>,
)
.unwrap();
<span class="macro">assert_eq!</span>(
datetime,
FixedOffset::east_opt(<span class="number">2 </span>* <span class="number">3600</span>).unwrap().with_ymd_and_hms(<span class="number">2015</span>, <span class="number">2</span>, <span class="number">18</span>, <span class="number">23</span>, <span class="number">16</span>, <span class="number">9</span>).unwrap()
);
<span class="macro">assert_eq!</span>(remainder, <span class="string">" trailing text"</span>);</code></pre></div>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-DateTime%3CTz%3E-1" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1096-1170">Source</a><a href="#impl-DateTime%3CTz%3E-1" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
Tz::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.format_with_items" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1104-1111">Source</a><h4 class="code-header">pub fn <a href="#method.format_with_items" class="fn">format_with_items</a><'a, I, B>(&self, items: I) -> <a class="struct" href="format/struct.DelayedFormat.html" title="struct chrono::format::DelayedFormat">DelayedFormat</a><I><div class="where">where
I: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/iter/traits/iterator/trait.Iterator.html" title="trait core::iter::traits::iterator::Iterator">Iterator</a><Item = B> + <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
B: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><<a class="enum" href="format/enum.Item.html" title="enum chrono::format::Item">Item</a><'a>>,</div></h4></section></summary><div class="docblock"><p>Formats the combined date and time with the specified formatting items.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.format" class="method"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1128-1130">Source</a><h4 class="code-header">pub fn <a href="#method.format" class="fn">format</a><'a>(&self, fmt: &'a <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.str.html">str</a>) -> <a class="struct" href="format/struct.DelayedFormat.html" title="struct chrono::format::DelayedFormat">DelayedFormat</a><<a class="struct" href="format/strftime/struct.StrftimeItems.html" title="struct chrono::format::strftime::StrftimeItems">StrftimeItems</a><'a>></h4></section></summary><div class="docblock"><p>Formats the combined date and time per the specified format string.</p>
<p>See the <a href="format/strftime/index.html" title="mod chrono::format::strftime"><code>crate::format::strftime</code></a> module for the supported escape sequences.</p>
<h5 id="example-13"><a class="doc-anchor" href="#example-13">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::prelude::<span class="kw-2">*</span>;
<span class="kw">let </span>date_time: DateTime<Utc> = Utc.with_ymd_and_hms(<span class="number">2017</span>, <span class="number">04</span>, <span class="number">02</span>, <span class="number">12</span>, <span class="number">50</span>, <span class="number">32</span>).unwrap();
<span class="kw">let </span>formatted = <span class="macro">format!</span>(<span class="string">"{}"</span>, date_time.format(<span class="string">"%d/%m/%Y %H:%M"</span>));
<span class="macro">assert_eq!</span>(formatted, <span class="string">"02/04/2017 12:50"</span>);</code></pre></div>
</div></details></div></details></div><h2 id="trait-implementations" class="section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Add%3CDays%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1731-1737">Source</a><a href="#impl-Add%3CDays%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><<a class="struct" href="struct.Days.html" title="struct chrono::Days">Days</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Add <code>Days</code> to <code>NaiveDateTime</code>.</p>
</div></section></summary><div class="docblock"><h4 id="panics-18"><a class="doc-anchor" href="#panics-18">§</a>Panics</h4>
<p>Panics 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>
<p>Strongly consider using <code>DateTime<Tz>::checked_add_days</code> to get an <code>Option</code> instead.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-10" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1732">Source</a><a href="#associatedtype.Output-10" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>+</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.add-4" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1734-1736">Source</a><a href="#method.add-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html#tymethod.add" class="fn">add</a>(self, days: <a class="struct" href="struct.Days.html" title="struct chrono::Days">Days</a>) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.85.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.85.0/core/ops/arith/trait.Add.html#tymethod.add">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Add%3CDuration%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1496-1505">Source</a><a href="#impl-Add%3CDuration%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><<a class="struct" href="https://doc.rust-lang.org/1.85.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Add <code>std::time::Duration</code> to <code>DateTime</code>.</p>
</div></section></summary><div class="docblock"><p>As a part of Chrono’s [leap second handling], the addition assumes that <strong>there is no leap
second ever</strong>, except when the <code>NaiveDateTime</code> itself represents a leap second in which case
the assumption becomes that <strong>there is exactly a single leap second ever</strong>.</p>
<h4 id="panics-7"><a class="doc-anchor" href="#panics-7">§</a>Panics</h4>
<p>Panics if the resulting date would be out of range.
Consider using <a href="struct.DateTime.html#method.checked_add_signed" title="method chrono::DateTime::checked_add_signed"><code>DateTime<Tz>::checked_add_signed</code></a> to get an <code>Option</code> instead.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1497">Source</a><a href="#associatedtype.Output-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>+</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.add-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1500-1504">Source</a><a href="#method.add-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.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.85.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Performs the <code>+</code> operation. <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html#tymethod.add">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Add%3CFixedOffset%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1551-1560">Source</a><a href="#impl-Add%3CFixedOffset%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Add <code>FixedOffset</code> to the datetime value of <code>DateTime</code> (offset remains unchanged).</p>
</div></section></summary><div class="docblock"><h4 id="panics-10"><a class="doc-anchor" href="#panics-10">§</a>Panics</h4>
<p>Panics if the resulting date would be out of range.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-2" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1552">Source</a><a href="#associatedtype.Output-2" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>+</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.add-2" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1555-1559">Source</a><a href="#method.add-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html#tymethod.add" class="fn">add</a>(self, rhs: <a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Performs the <code>+</code> operation. <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html#tymethod.add">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Add%3CMonths%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1575-1581">Source</a><a href="#impl-Add%3CMonths%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><<a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Add <code>Months</code> to <code>DateTime</code>.</p>
</div></section></summary><div class="docblock"><p>The result will be clamped to valid days in the resulting month, see <code>checked_add_months</code> for
details.</p>
<h4 id="panics-11"><a class="doc-anchor" href="#panics-11">§</a>Panics</h4>
<p>Panics 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>
<p>Strongly consider using <a href="struct.DateTime.html#method.checked_add_months" title="method chrono::DateTime::checked_add_months"><code>DateTime<Tz>::checked_add_months</code></a> to get an <code>Option</code> instead.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-3" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1576">Source</a><a href="#associatedtype.Output-3" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>+</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.add-3" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1578-1580">Source</a><a href="#method.add-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html#tymethod.add" class="fn">add</a>(self, rhs: <a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.85.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.85.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%3CTimeDelta%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1477-1484">Source</a><a href="#impl-Add%3CTimeDelta%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><<a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Add <code>TimeDelta</code> to <code>DateTime</code>.</p>
</div></section></summary><div class="docblock"><p>As a part of Chrono’s [leap second handling], the addition assumes that <strong>there is no leap
second ever</strong>, except when the <code>NaiveDateTime</code> itself represents a leap second in which case
the assumption becomes that <strong>there is exactly a single leap second ever</strong>.</p>
<h4 id="panics-6"><a class="doc-anchor" href="#panics-6">§</a>Panics</h4>
<p>Panics if the resulting date would be out of range.
Consider using <a href="struct.DateTime.html#method.checked_add_signed" title="method chrono::DateTime::checked_add_signed"><code>DateTime<Tz>::checked_add_signed</code></a> to get an <code>Option</code> instead.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1478">Source</a><a href="#associatedtype.Output" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>+</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.add" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1481-1483">Source</a><a href="#method.add" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html#tymethod.add" class="fn">add</a>(self, rhs: <a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Performs the <code>+</code> operation. <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html#tymethod.add">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1537-1544">Source</a><a href="#impl-AddAssign%3CDuration%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.AddAssign.html" title="trait core::ops::arith::AddAssign">AddAssign</a><<a class="struct" href="https://doc.rust-lang.org/1.85.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Add-assign <code>std::time::Duration</code> to <code>DateTime</code>.</p>
</div></section></summary><div class="docblock"><p>As a part of Chrono’s [leap second handling], the addition assumes that <strong>there is no leap
second ever</strong>, except when the <code>NaiveDateTime</code> itself represents a leap second in which case
the assumption becomes that <strong>there is exactly a single leap second ever</strong>.</p>
<h4 id="panics-9"><a class="doc-anchor" href="#panics-9">§</a>Panics</h4>
<p>Panics if the resulting date would be out of range.
Consider using <a href="struct.DateTime.html#method.checked_add_signed" title="method chrono::DateTime::checked_add_signed"><code>DateTime<Tz>::checked_add_signed</code></a> to get an <code>Option</code> instead.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.add_assign-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1539-1543">Source</a><a href="#method.add_assign-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.AddAssign.html#tymethod.add_assign" class="fn">add_assign</a>(&mut self, rhs: <a class="struct" href="https://doc.rust-lang.org/1.85.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.85.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%3CTimeDelta%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1517-1525">Source</a><a href="#impl-AddAssign%3CTimeDelta%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.AddAssign.html" title="trait core::ops::arith::AddAssign">AddAssign</a><<a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Add-assign <code>chrono::Duration</code> to <code>DateTime</code>.</p>
</div></section></summary><div class="docblock"><p>As a part of Chrono’s [leap second handling], the addition assumes that <strong>there is no leap
second ever</strong>, except when the <code>NaiveDateTime</code> itself represents a leap second in which case
the assumption becomes that <strong>there is exactly a single leap second ever</strong>.</p>
<h4 id="panics-8"><a class="doc-anchor" href="#panics-8">§</a>Panics</h4>
<p>Panics if the resulting date would be out of range.
Consider using <a href="struct.DateTime.html#method.checked_add_signed" title="method chrono::DateTime::checked_add_signed"><code>DateTime<Tz>::checked_add_signed</code></a> to get an <code>Option</code> instead.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.add_assign" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1519-1524">Source</a><a href="#method.add_assign" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.AddAssign.html#tymethod.add_assign" class="fn">add_assign</a>(&mut self, rhs: <a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>)</h4></section></summary><div class='docblock'>Performs the <code>+=</code> operation. <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.AddAssign.html#tymethod.add_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#49">Source</a><a href="#impl-Clone-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
Tz::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#49">Source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&self) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/1.85.0/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.0/src/core/clone.rs.html#174">Source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&mut self, source: &Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/1.85.0/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Datelike-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1172-1327">Source</a><a href="#impl-Datelike-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="trait.Datelike.html" title="trait chrono::Datelike">Datelike</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_year" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1223-1228">Source</a><a href="#method.with_year" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_year" class="fn">with_year</a>(&self, year: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.i32.html">i32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the year number changed, while keeping the same month and day.</p>
<p>See also the <a href="struct.NaiveDate.html#method.with_year" title="method chrono::NaiveDate::with_year"><code>NaiveDate::with_year</code></a> method.</p>
<h5 id="errors-12"><a class="doc-anchor" href="#errors-12">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The resulting date does not exist (February 29 in a non-leap year).</li>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
<li>The resulting UTC datetime would be out of range.</li>
<li>The resulting local datetime would be out of range (unless the year remains the same).</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_month" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1244-1246">Source</a><a href="#method.with_month" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_month" class="fn">with_month</a>(&self, month: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the month number (starting from 1) changed.</p>
<p>Don’t combine multiple <code>Datelike::with_*</code> methods. The intermediate value may not exist.</p>
<p>See also the <a href="struct.NaiveDate.html#method.with_month" title="method chrono::NaiveDate::with_month"><code>NaiveDate::with_month</code></a> method.</p>
<h5 id="errors-13"><a class="doc-anchor" href="#errors-13">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The resulting date does not exist (for example <code>month(4)</code> when day of the month is 31).</li>
<li>The value for <code>month</code> is invalid.</li>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_month0" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1260-1262">Source</a><a href="#method.with_month0" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_month0" class="fn">with_month0</a>(&self, month0: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the month number (starting from 0) changed.</p>
<p>See also the <a href="struct.NaiveDate.html#method.with_month0" title="method chrono::NaiveDate::with_month0"><code>NaiveDate::with_month0</code></a> method.</p>
<h5 id="errors-14"><a class="doc-anchor" href="#errors-14">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The resulting date does not exist (for example <code>month0(3)</code> when day of the month is 31).</li>
<li>The value for <code>month0</code> is invalid.</li>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_day" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1276-1278">Source</a><a href="#method.with_day" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_day" class="fn">with_day</a>(&self, day: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the day of month (starting from 1) changed.</p>
<p>See also the <a href="struct.NaiveDate.html#method.with_day" title="method chrono::NaiveDate::with_day"><code>NaiveDate::with_day</code></a> method.</p>
<h5 id="errors-15"><a class="doc-anchor" href="#errors-15">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The resulting date does not exist (for example <code>day(31)</code> in April).</li>
<li>The value for <code>day</code> is invalid.</li>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_day0" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1292-1294">Source</a><a href="#method.with_day0" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_day0" class="fn">with_day0</a>(&self, day0: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the day of month (starting from 0) changed.</p>
<p>See also the <a href="struct.NaiveDate.html#method.with_day0" title="method chrono::NaiveDate::with_day0"><code>NaiveDate::with_day0</code></a> method.</p>
<h5 id="errors-16"><a class="doc-anchor" href="#errors-16">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The resulting date does not exist (for example <code>day(30)</code> in April).</li>
<li>The value for <code>day0</code> is invalid.</li>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_ordinal" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1308-1310">Source</a><a href="#method.with_ordinal" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_ordinal" class="fn">with_ordinal</a>(&self, ordinal: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the day of year (starting from 1) changed.</p>
<p>See also the <a href="struct.NaiveDate.html#method.with_ordinal" title="method chrono::NaiveDate::with_ordinal"><code>NaiveDate::with_ordinal</code></a> method.</p>
<h5 id="errors-17"><a class="doc-anchor" href="#errors-17">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The resulting date does not exist (<code>with_ordinal(366)</code> in a non-leap year).</li>
<li>The value for <code>ordinal</code> is invalid.</li>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_ordinal0" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1324-1326">Source</a><a href="#method.with_ordinal0" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.with_ordinal0" class="fn">with_ordinal0</a>(&self, ordinal0: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the day of year (starting from 0) changed.</p>
<p>See also the <a href="struct.NaiveDate.html#method.with_ordinal0" title="method chrono::NaiveDate::with_ordinal0"><code>NaiveDate::with_ordinal0</code></a> method.</p>
<h5 id="errors-18"><a class="doc-anchor" href="#errors-18">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The resulting date does not exist (<code>with_ordinal0(365)</code> in a non-leap year).</li>
<li>The value for <code>ordinal0</code> is invalid.</li>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.year" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1174-1176">Source</a><a href="#method.year" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.year" class="fn">year</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.i32.html">i32</a></h4></section></summary><div class='docblock'>Returns the year number in the <a href="./naive/struct.NaiveDate.html#calendar-date">calendar date</a>.</div></details><details class="toggle method-toggle" open><summary><section id="method.month" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1178-1180">Source</a><a href="#method.month" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.month" class="fn">month</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the month number starting from 1. <a href="trait.Datelike.html#tymethod.month">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.month0" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1182-1184">Source</a><a href="#method.month0" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.month0" class="fn">month0</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the month number starting from 0. <a href="trait.Datelike.html#tymethod.month0">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.day" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1186-1188">Source</a><a href="#method.day" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.day" class="fn">day</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the day of month starting from 1. <a href="trait.Datelike.html#tymethod.day">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.day0" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1190-1192">Source</a><a href="#method.day0" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.day0" class="fn">day0</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the day of month starting from 0. <a href="trait.Datelike.html#tymethod.day0">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ordinal" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1194-1196">Source</a><a href="#method.ordinal" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.ordinal" class="fn">ordinal</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the day of year starting from 1. <a href="trait.Datelike.html#tymethod.ordinal">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ordinal0" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1198-1200">Source</a><a href="#method.ordinal0" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.ordinal0" class="fn">ordinal0</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the day of year starting from 0. <a href="trait.Datelike.html#tymethod.ordinal0">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.weekday" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1202-1204">Source</a><a href="#method.weekday" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.weekday" class="fn">weekday</a>(&self) -> <a class="enum" href="enum.Weekday.html" title="enum chrono::Weekday">Weekday</a></h4></section></summary><div class='docblock'>Returns the day of week.</div></details><details class="toggle method-toggle" open><summary><section id="method.iso_week" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1206-1208">Source</a><a href="#method.iso_week" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#tymethod.iso_week" class="fn">iso_week</a>(&self) -> <a class="struct" href="naive/struct.IsoWeek.html" title="struct chrono::naive::IsoWeek">IsoWeek</a></h4></section></summary><div class='docblock'>Returns the ISO week.</div></details><details class="toggle method-toggle" open><summary><section id="method.year_ce" class="method trait-impl"><a class="src rightside" href="../src/chrono/traits.rs.html#38-41">Source</a><a href="#method.year_ce" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#method.year_ce" class="fn">year_ce</a>(&self) -> (<a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.bool.html">bool</a>, <a class="primitive" href="https://doc.rust-lang.org/1.85.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.quarter" class="method trait-impl"><a class="src rightside" href="../src/chrono/traits.rs.html#47-49">Source</a><a href="#method.quarter" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#method.quarter" class="fn">quarter</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the quarter number starting from 1. <a href="trait.Datelike.html#method.quarter">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.num_days_from_ce" class="method trait-impl"><a class="src rightside" href="../src/chrono/traits.rs.html#252-267">Source</a><a href="#method.num_days_from_ce" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Datelike.html#method.num_days_from_ce" class="fn">num_days_from_ce</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.i32.html">i32</a></h4></section></summary><div class='docblock'>Counts the days in the proleptic Gregorian calendar, with January 1, Year 1 (CE) as day 1. <a href="trait.Datelike.html#method.num_days_from_ce">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Debug-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1757-1762">Source</a><a href="#impl-Debug-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1758-1761">Source</a><a href="#method.fmt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/fmt/trait.Debug.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.85.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.85.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.85.0/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-DateTime%3CFixedOffset%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#877-881">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.85.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default-2" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#878-880">Source</a><a href="#method.default-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.85.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-DateTime%3CLocal%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#871-875">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.85.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Local.html" title="struct chrono::Local">Local</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#872-874">Source</a><a href="#method.default-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.85.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Default-for-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#864-868">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.85.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.default" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#865-867">Source</a><a href="#method.default" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/default/trait.Default.html#tymethod.default" class="fn">default</a>() -> Self</h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/1.85.0/core/default/trait.Default.html#tymethod.default">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Deserialize%3C'de%3E-for-DateTime%3CFixedOffset%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#76-83">Source</a><a href="#impl-Deserialize%3C'de%3E-for-DateTime%3CFixedOffset%3E" class="anchor">§</a><h3 class="code-header">impl<'de> <a class="trait" href="../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a><'de> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>></h3><div class="docblock"><p>Deserialize an RFC 3339 formatted string into a <code>DateTime<FixedOffset></code></p>
</div></section></summary><div class="docblock"><p>As an extension to RFC 3339 this can deserialize to <code>DateTime</code>s outside the range of 0-9999
years using an ISO 8601 syntax (which prepends an <code>-</code> or <code>+</code>).</p>
<p>See <a href="serde/index.html" title="mod chrono::serde">the <code>serde</code> module</a> for alternate deserialization formats.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.deserialize" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#77-82">Source</a><a href="#method.deserialize" class="anchor">§</a><h4 class="code-header">fn <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize" class="fn">deserialize</a><D>(deserializer: D) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, D::<a class="associatedtype" href="../serde/de/trait.Deserializer.html#associatedtype.Error" title="type serde::de::Deserializer::Error">Error</a>><div class="where">where
D: <a class="trait" href="../serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a><'de>,</div></h4></section></summary><div class='docblock'>Deserialize this value from the given Serde deserializer. <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Deserialize%3C'de%3E-for-DateTime%3CLocal%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#112-119">Source</a><a href="#impl-Deserialize%3C'de%3E-for-DateTime%3CLocal%3E" class="anchor">§</a><h3 class="code-header">impl<'de> <a class="trait" href="../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a><'de> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Local.html" title="struct chrono::Local">Local</a>></h3><div class="docblock"><p>Deserialize an RFC 3339 formatted string into a <code>DateTime<Local></code></p>
</div></section></summary><div class="docblock"><p>The value will remain the same instant in UTC, but the offset will be recalculated to match
that of the <code>Local</code> platform time zone.</p>
<p>As an extension to RFC 3339 this can deserialize to <code>DateTime</code>s outside the range of 0-9999
years using an ISO 8601 syntax (which prepends an <code>-</code> or <code>+</code>).</p>
<p>See <a href="serde/index.html" title="mod chrono::serde">the <code>serde</code> module</a> for alternate deserialization formats.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.deserialize-2" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#113-118">Source</a><a href="#method.deserialize-2" class="anchor">§</a><h4 class="code-header">fn <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize" class="fn">deserialize</a><D>(deserializer: D) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, D::<a class="associatedtype" href="../serde/de/trait.Deserializer.html#associatedtype.Error" title="type serde::de::Deserializer::Error">Error</a>><div class="where">where
D: <a class="trait" href="../serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a><'de>,</div></h4></section></summary><div class='docblock'>Deserialize this value from the given Serde deserializer. <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Deserialize%3C'de%3E-for-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#93-100">Source</a><a href="#impl-Deserialize%3C'de%3E-for-DateTime%3CUtc%3E" class="anchor">§</a><h3 class="code-header">impl<'de> <a class="trait" href="../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a><'de> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>></h3><div class="docblock"><p>Deserialize an RFC 3339 formatted string into a <code>DateTime<Utc></code></p>
</div></section></summary><div class="docblock"><p>If the value contains an offset from UTC that is not zero, the value will be converted to UTC.</p>
<p>As an extension to RFC 3339 this can deserialize to <code>DateTime</code>s outside the range of 0-9999
years using an ISO 8601 syntax (which prepends an <code>-</code> or <code>+</code>).</p>
<p>See <a href="serde/index.html" title="mod chrono::serde">the <code>serde</code> module</a> for alternate deserialization formats.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.deserialize-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#94-99">Source</a><a href="#method.deserialize-1" class="anchor">§</a><h4 class="code-header">fn <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize" class="fn">deserialize</a><D>(deserializer: D) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, D::<a class="associatedtype" href="../serde/de/trait.Deserializer.html#associatedtype.Error" title="type serde::de::Deserializer::Error">Error</a>><div class="where">where
D: <a class="trait" href="../serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a><'de>,</div></h4></section></summary><div class='docblock'>Deserialize this value from the given Serde deserializer. <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Display-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1789-1798">Source</a><a href="#impl-Display-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
Tz::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.fmt-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1793-1797">Source</a><a href="#method.fmt-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/fmt/trait.Display.html#tymethod.fmt" class="fn">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/1.85.0/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/1.85.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.85.0/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-DurationRound-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/round.rs.html#184-198">Source</a><a href="#impl-DurationRound-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="round/trait.DurationRound.html" title="trait chrono::round::DurationRound">DurationRound</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Err-3" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/round.rs.html#185">Source</a><a href="#associatedtype.Err-3" class="anchor">§</a><h4 class="code-header">type <a href="round/trait.DurationRound.html#associatedtype.Err" class="associatedtype">Err</a> = <a class="enum" href="round/enum.RoundingError.html" title="enum chrono::round::RoundingError">RoundingError</a></h4></section></summary><div class='docblock'>Error that can occur in rounding or truncating</div></details><details class="toggle method-toggle" open><summary><section id="method.duration_round" class="method trait-impl"><a class="src rightside" href="../src/chrono/round.rs.html#187-189">Source</a><a href="#method.duration_round" class="anchor">§</a><h4 class="code-header">fn <a href="round/trait.DurationRound.html#tymethod.duration_round" class="fn">duration_round</a>(self, duration: <a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, Self::<a class="associatedtype" href="round/trait.DurationRound.html#associatedtype.Err" title="type chrono::round::DurationRound::Err">Err</a>></h4></section></summary><div class='docblock'>Return a copy rounded by TimeDelta. <a href="round/trait.DurationRound.html#tymethod.duration_round">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.duration_trunc" class="method trait-impl"><a class="src rightside" href="../src/chrono/round.rs.html#191-193">Source</a><a href="#method.duration_trunc" class="anchor">§</a><h4 class="code-header">fn <a href="round/trait.DurationRound.html#tymethod.duration_trunc" class="fn">duration_trunc</a>(self, duration: <a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, Self::<a class="associatedtype" href="round/trait.DurationRound.html#associatedtype.Err" title="type chrono::round::DurationRound::Err">Err</a>></h4></section></summary><div class='docblock'>Return a copy truncated by TimeDelta. <a href="round/trait.DurationRound.html#tymethod.duration_trunc">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.duration_round_up" class="method trait-impl"><a class="src rightside" href="../src/chrono/round.rs.html#195-197">Source</a><a href="#method.duration_round_up" class="anchor">§</a><h4 class="code-header">fn <a href="round/trait.DurationRound.html#tymethod.duration_round_up" class="fn">duration_round_up</a>(self, duration: <a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, Self::<a class="associatedtype" href="round/trait.DurationRound.html#associatedtype.Err" title="type chrono::round::DurationRound::Err">Err</a>></h4></section></summary><div class='docblock'>Return a copy rounded <strong>up</strong> by TimeDelta. <a href="round/trait.DurationRound.html#tymethod.duration_round_up">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CFixedOffset%3E%3E-for-DateTime%3CLocal%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#918-926">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.85.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Local.html" title="struct chrono::Local">Local</a>></h3><div class="docblock"><p>Convert a <code>DateTime<FixedOffset></code> instance into a <code>DateTime<Local></code> instance.</p>
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-3" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#923-925">Source</a><a href="#method.from-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>>) -> Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime<FixedOffset></code> instance into a <code>DateTime<Local></code> instance.</p>
<p>Conversion is performed via <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>. Returns the equivalent value in local
time.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CFixedOffset%3E%3E-for-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#906-914">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.85.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>></h3><div class="docblock"><p>Convert a <code>DateTime<FixedOffset></code> instance into a <code>DateTime<Utc></code> instance.</p>
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-2" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#911-913">Source</a><a href="#method.from-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>>) -> Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime<FixedOffset></code> instance into a <code>DateTime<Utc></code> instance.</p>
<p>Conversion is performed via <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>, accounting for the timezone
difference.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CLocal%3E%3E-for-DateTime%3CFixedOffset%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#942-949">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.85.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Local.html" title="struct chrono::Local">Local</a>>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>></h3><div class="docblock"><p>Convert a <code>DateTime<Local></code> instance into a <code>DateTime<FixedOffset></code> instance.</p>
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-5" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#946-948">Source</a><a href="#method.from-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Local.html" title="struct chrono::Local">Local</a>>) -> Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime<Local></code> instance into a <code>DateTime<FixedOffset></code> instance.</p>
<p>Conversion is performed via <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CLocal%3E%3E-for-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#930-938">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.85.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Local.html" title="struct chrono::Local">Local</a>>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>></h3><div class="docblock"><p>Convert a <code>DateTime<Local></code> instance into a <code>DateTime<Utc></code> instance.</p>
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-4" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#935-937">Source</a><a href="#method.from-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Local.html" title="struct chrono::Local">Local</a>>) -> Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime<Local></code> instance into a <code>DateTime<Utc></code> instance.</p>
<p>Conversion is performed via <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>, accounting for the difference in
timezones.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CTz%3E%3E-for-SystemTime" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1867-1878">Source</a><a href="#impl-From%3CDateTime%3CTz%3E%3E-for-SystemTime" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>> for <a class="struct" href="https://doc.rust-lang.org/1.85.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-8" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1868-1877">Source</a><a href="#method.from-8" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(dt: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>) -> <a class="struct" href="https://doc.rust-lang.org/1.85.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CUtc%3E%3E-for-DateTime%3CFixedOffset%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#884-892">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.85.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>></h3><div class="docblock"><p>Convert a <code>DateTime<Utc></code> instance into a <code>DateTime<FixedOffset></code> instance.</p>
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#889-891">Source</a><a href="#method.from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>>) -> Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime<Utc></code> instance into a <code>DateTime<FixedOffset></code> instance.</p>
<p>Conversion is done via <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>. Note that the converted value returned by
this will be created with a fixed timezone offset of 0.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CDateTime%3CUtc%3E%3E-for-DateTime%3CLocal%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#896-903">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.85.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Local.html" title="struct chrono::Local">Local</a>></h3><div class="docblock"><p>Convert a <code>DateTime<Utc></code> instance into a <code>DateTime<Local></code> instance.</p>
</div></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#900-902">Source</a><a href="#method.from-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(src: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>>) -> Self</h4></section></summary><div class="docblock"><p>Convert this <code>DateTime<Utc></code> instance into a <code>DateTime<Local></code> instance.</p>
<p>Conversion is performed via <a href="struct.DateTime.html#method.with_timezone" title="method chrono::DateTime::with_timezone"><code>DateTime::with_timezone</code></a>, accounting for the difference in timezones.</p>
</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CSystemTime%3E-for-DateTime%3CLocal%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1860-1864">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.85.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Local.html" title="struct chrono::Local">Local</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-7" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1861-1863">Source</a><a href="#method.from-7" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: <a class="struct" href="https://doc.rust-lang.org/1.85.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Local.html" title="struct chrono::Local">Local</a>></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-From%3CSystemTime%3E-for-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1844-1857">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.85.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/1.85.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-6" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1845-1856">Source</a><a href="#method.from-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: <a class="struct" href="https://doc.rust-lang.org/1.85.0/std/time/struct.SystemTime.html" title="struct std::time::SystemTime">SystemTime</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>></h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromStr-for-DateTime%3CFixedOffset%3E" class="impl"><a class="src rightside" href="../src/chrono/format/parse.rs.html#523-534">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.85.0/core/str/traits/trait.FromStr.html" title="trait core::str::traits::FromStr">FromStr</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>></h3><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. Additional spaces are allowed between each component.</p>
</div></section></summary><div class="docblock"><p>All of these examples are equivalent:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="string">"2012-12-12T12:12:12Z"</span>.parse::<DateTime<FixedOffset>>()<span class="question-mark">?</span>;
<span class="string">"2012-12-12 12:12:12Z"</span>.parse::<DateTime<FixedOffset>>()<span class="question-mark">?</span>;
<span class="string">"2012- 12-12T12: 12:12Z"</span>.parse::<DateTime<FixedOffset>>()<span class="question-mark">?</span>;</code></pre></div>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Err-2" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/format/parse.rs.html#524">Source</a><a href="#associatedtype.Err-2" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/str/traits/trait.FromStr.html#associatedtype.Err" class="associatedtype">Err</a> = <a class="struct" href="format/struct.ParseError.html" title="struct chrono::format::ParseError">ParseError</a></h4></section></summary><div class='docblock'>The associated error which can be returned from parsing.</div></details><details class="toggle method-toggle" open><summary><section id="method.from_str-2" class="method trait-impl"><a class="src rightside" href="../src/chrono/format/parse.rs.html#526-533">Source</a><a href="#method.from_str-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/str/traits/trait.FromStr.html#tymethod.from_str" class="fn">from_str</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.str.html">str</a>) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>>></h4></section></summary><div class='docblock'>Parses a string <code>s</code> to return a value of this type. <a href="https://doc.rust-lang.org/1.85.0/core/str/traits/trait.FromStr.html#tymethod.from_str">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromStr-for-DateTime%3CLocal%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1835-1841">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.85.0/core/str/traits/trait.FromStr.html" title="trait core::str::traits::FromStr">FromStr</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Local.html" title="struct chrono::Local">Local</a>></h3><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>
</div></section></summary><div class="docblock"><p>All of these examples are equivalent:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="string">"2012-12-12T12:12:12Z"</span>.parse::<DateTime<Local>>()<span class="question-mark">?</span>;
<span class="string">"2012-12-12 12:12:12Z"</span>.parse::<DateTime<Local>>()<span class="question-mark">?</span>;
<span class="string">"2012-12-12 12:12:12+0000"</span>.parse::<DateTime<Local>>()<span class="question-mark">?</span>;
<span class="string">"2012-12-12 12:12:12+00:00"</span>.parse::<DateTime<Local>>()<span class="question-mark">?</span>;</code></pre></div>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Err-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1836">Source</a><a href="#associatedtype.Err-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/str/traits/trait.FromStr.html#associatedtype.Err" class="associatedtype">Err</a> = <a class="struct" href="format/struct.ParseError.html" title="struct chrono::format::ParseError">ParseError</a></h4></section></summary><div class='docblock'>The associated error which can be returned from parsing.</div></details><details class="toggle method-toggle" open><summary><section id="method.from_str-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1838-1840">Source</a><a href="#method.from_str-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/str/traits/trait.FromStr.html#tymethod.from_str" class="fn">from_str</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.str.html">str</a>) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Local.html" title="struct chrono::Local">Local</a>>></h4></section></summary><div class='docblock'>Parses a string <code>s</code> to return a value of this type. <a href="https://doc.rust-lang.org/1.85.0/core/str/traits/trait.FromStr.html#tymethod.from_str">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-FromStr-for-DateTime%3CUtc%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1813-1819">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.85.0/core/str/traits/trait.FromStr.html" title="trait core::str::traits::FromStr">FromStr</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>></h3><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>
</div></section></summary><div class="docblock"><p>All of these examples are equivalent:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="string">"2012-12-12T12:12:12Z"</span>.parse::<DateTime<Utc>>()<span class="question-mark">?</span>;
<span class="string">"2012-12-12 12:12:12Z"</span>.parse::<DateTime<Utc>>()<span class="question-mark">?</span>;
<span class="string">"2012-12-12 12:12:12+0000"</span>.parse::<DateTime<Utc>>()<span class="question-mark">?</span>;
<span class="string">"2012-12-12 12:12:12+00:00"</span>.parse::<DateTime<Utc>>()<span class="question-mark">?</span>;</code></pre></div>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Err" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1814">Source</a><a href="#associatedtype.Err" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/str/traits/trait.FromStr.html#associatedtype.Err" class="associatedtype">Err</a> = <a class="struct" href="format/struct.ParseError.html" title="struct chrono::format::ParseError">ParseError</a></h4></section></summary><div class='docblock'>The associated error which can be returned from parsing.</div></details><details class="toggle method-toggle" open><summary><section id="method.from_str" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1816-1818">Source</a><a href="#method.from_str" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/str/traits/trait.FromStr.html#tymethod.from_str" class="fn">from_str</a>(s: &<a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.str.html">str</a>) -> <a class="type" href="format/type.ParseResult.html" title="type chrono::format::ParseResult">ParseResult</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><<a class="struct" href="struct.Utc.html" title="struct chrono::Utc">Utc</a>>></h4></section></summary><div class='docblock'>Parses a string <code>s</code> to return a value of this type. <a href="https://doc.rust-lang.org/1.85.0/core/str/traits/trait.FromStr.html#tymethod.from_str">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Hash-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1461-1465">Source</a><a href="#impl-Hash-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.hash" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1462-1464">Source</a><a href="#method.hash" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/hash/trait.Hash.html#tymethod.hash" class="fn">hash</a><H: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>>(&self, state: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.reference.html">&mut H</a>)</h4></section></summary><div class='docblock'>Feeds this value into the given <a href="https://doc.rust-lang.org/1.85.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.85.0/core/hash/trait.Hash.html#tymethod.hash">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.hash_slice" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.0/src/core/hash/mod.rs.html#235-237">Source</a></span><a href="#method.hash_slice" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/hash/trait.Hash.html#method.hash_slice" class="fn">hash_slice</a><H>(data: &[Self], state: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.reference.html">&mut H</a>)<div class="where">where
H: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,
Self: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/1.85.0/core/hash/trait.Hasher.html" title="trait core::hash::Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/1.85.0/core/hash/trait.Hash.html#method.hash_slice">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Ord-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1455-1459">Source</a><a href="#impl-Ord-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1456-1458">Source</a><a href="#method.cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.Ord.html#tymethod.cmp" class="fn">cmp</a>(&self, other: &<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.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.85.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.85.0/core/cmp/trait.Ord.html#tymethod.cmp">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.max" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.0/src/core/cmp.rs.html#980-982">Source</a></span><a href="#method.max" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.Ord.html#method.max" class="fn">max</a>(self, other: Self) -> Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.Ord.html#method.max">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.min" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.0/src/core/cmp.rs.html#1001-1003">Source</a></span><a href="#method.min" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.Ord.html#method.min" class="fn">min</a>(self, other: Self) -> Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.Ord.html#method.min">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clamp" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.0/src/core/cmp.rs.html#1027-1029">Source</a></span><a href="#method.clamp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.Ord.html#method.clamp" class="fn">clamp</a>(self, min: Self, max: Self) -> Self<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class='docblock'>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.Ord.html#method.clamp">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1420-1424">Source</a><a href="#impl-PartialEq%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>, Tz2: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz2>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1421-1423">Source</a><a href="#method.eq" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialEq.html#tymethod.eq" class="fn">eq</a>(&self, other: &<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz2>) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>.</div></details><details class="toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.0/src/core/cmp.rs.html#261">Source</a></span><a href="#method.ne" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialEq.html#method.ne" class="fn">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests for <code>!=</code>. The default implementation is almost always sufficient,
and should not be overridden without very good reason.</div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1428-1453">Source</a><a href="#impl-PartialOrd%3CDateTime%3CTz2%3E%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>, Tz2: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz2>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1450-1452">Source</a><a href="#method.partial_cmp" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp" class="fn">partial_cmp</a>(&self, other: &<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz2>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="https://doc.rust-lang.org/1.85.0/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>></h4></section></summary><div class="docblock"><p>Compare two DateTimes based on their true time, ignoring time zones</p>
<h5 id="example-14"><a class="doc-anchor" href="#example-14">§</a>Example</h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>chrono::prelude::<span class="kw-2">*</span>;
<span class="kw">let </span>earlier = Utc
.with_ymd_and_hms(<span class="number">2015</span>, <span class="number">5</span>, <span class="number">15</span>, <span class="number">2</span>, <span class="number">0</span>, <span class="number">0</span>)
.unwrap()
.with_timezone(<span class="kw-2">&</span>FixedOffset::west_opt(<span class="number">1 </span>* <span class="number">3600</span>).unwrap());
<span class="kw">let </span>later = Utc
.with_ymd_and_hms(<span class="number">2015</span>, <span class="number">5</span>, <span class="number">15</span>, <span class="number">3</span>, <span class="number">0</span>, <span class="number">0</span>)
.unwrap()
.with_timezone(<span class="kw-2">&</span>FixedOffset::west_opt(<span class="number">5 </span>* <span class="number">3600</span>).unwrap());
<span class="macro">assert_eq!</span>(earlier.to_string(), <span class="string">"2015-05-15 01:00:00 -01:00"</span>);
<span class="macro">assert_eq!</span>(later.to_string(), <span class="string">"2015-05-14 22:00:00 -05:00"</span>);
<span class="macro">assert!</span>(later > earlier);</code></pre></div>
</div></details><details class="toggle method-toggle" open><summary><section id="method.lt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.0/src/core/cmp.rs.html#1335">Source</a></span><a href="#method.lt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialOrd.html#method.lt" class="fn">lt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.le" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.0/src/core/cmp.rs.html#1353">Source</a></span><a href="#method.le" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialOrd.html#method.le" class="fn">le</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the
<code><=</code> operator. <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialOrd.html#method.le">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.gt" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.0/src/core/cmp.rs.html#1371">Source</a></span><a href="#method.gt" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialOrd.html#method.gt" class="fn">gt</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code>
operator. <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.ge" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/1.85.0/src/core/cmp.rs.html#1389">Source</a></span><a href="#method.ge" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialOrd.html#method.ge" class="fn">ge</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.reference.html">&Rhs</a>) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by
the <code>>=</code> operator. <a href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.PartialOrd.html#method.ge">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Serialize-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#32-51">Source</a><a href="#impl-Serialize-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="../serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Serialize to an RFC 3339 formatted string</p>
</div></section></summary><div class="docblock"><p>As an extension to RFC 3339 this can serialize <code>DateTime</code>s outside the range of 0-9999 years
using an ISO 8601 syntax (which prepends an <code>-</code> or <code>+</code>).</p>
<p>See <a href="serde/index.html" title="mod chrono::serde">the <code>serde</code> module</a> for alternate serializations.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.serialize" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/serde.rs.html#33-50">Source</a><a href="#method.serialize" class="anchor">§</a><h4 class="code-header">fn <a href="../serde/ser/trait.Serialize.html#tymethod.serialize" class="fn">serialize</a><S>(&self, serializer: S) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="associatedtype" href="../serde/ser/trait.Serializer.html#associatedtype.Ok" title="type serde::ser::Serializer::Ok">Ok</a>, S::<a class="associatedtype" href="../serde/ser/trait.Serializer.html#associatedtype.Error" title="type serde::ser::Serializer::Error">Error</a>><div class="where">where
S: <a class="trait" href="../serde/ser/trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a>,</div></h4></section></summary><div class='docblock'>Serialize this value into the given Serde serializer. <a href="../serde/ser/trait.Serialize.html#tymethod.serialize">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub%3C%26DateTime%3CTz%3E%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1712-1719">Source</a><a href="#impl-Sub%3C%26DateTime%3CTz%3E%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><&<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-9" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1713">Source</a><a href="#associatedtype.Output-9" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</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="src rightside" href="../src/chrono/datetime/mod.rs.html#1716-1718">Source</a><a href="#method.sub-5" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, rhs: &<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>) -> <a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a></h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub%3CDays%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1749-1755">Source</a><a href="#impl-Sub%3CDays%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><<a class="struct" href="struct.Days.html" title="struct chrono::Days">Days</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Subtract <code>Days</code> from <code>DateTime</code>.</p>
</div></section></summary><div class="docblock"><h4 id="panics-19"><a class="doc-anchor" href="#panics-19">§</a>Panics</h4>
<p>Panics 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>
<p>Strongly consider using <code>DateTime<Tz>::checked_sub_days</code> to get an <code>Option</code> instead.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-11" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1750">Source</a><a href="#associatedtype.Output-11" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.sub-6" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1752-1754">Source</a><a href="#method.sub-6" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, days: <a class="struct" href="struct.Days.html" title="struct chrono::Days">Days</a>) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.85.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.85.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub%3CDuration%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1614-1623">Source</a><a href="#impl-Sub%3CDuration%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><<a class="struct" href="https://doc.rust-lang.org/1.85.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Subtract <code>std::time::Duration</code> from <code>DateTime</code>.</p>
</div></section></summary><div class="docblock"><p>As a part of Chrono’s [leap second handling] the subtraction assumes that <strong>there is no leap
second ever</strong>, except when the <code>DateTime</code> itself represents a leap second in which case
the assumption becomes that <strong>there is exactly a single leap second ever</strong>.</p>
<h4 id="panics-13"><a class="doc-anchor" href="#panics-13">§</a>Panics</h4>
<p>Panics if the resulting date would be out of range.
Consider using <a href="struct.DateTime.html#method.checked_sub_signed" title="method chrono::DateTime::checked_sub_signed"><code>DateTime<Tz>::checked_sub_signed</code></a> to get an <code>Option</code> instead.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-5" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1615">Source</a><a href="#associatedtype.Output-5" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.sub-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1618-1622">Source</a><a href="#method.sub-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.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.85.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub%3CFixedOffset%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1671-1680">Source</a><a href="#impl-Sub%3CFixedOffset%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><<a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Subtract <code>FixedOffset</code> from the datetime value of <code>DateTime</code> (offset remains unchanged).</p>
</div></section></summary><div class="docblock"><h4 id="panics-16"><a class="doc-anchor" href="#panics-16">§</a>Panics</h4>
<p>Panics if the resulting date would be out of range.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-6" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1672">Source</a><a href="#associatedtype.Output-6" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.sub-2" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1675-1679">Source</a><a href="#method.sub-2" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, rhs: <a class="struct" href="struct.FixedOffset.html" title="struct chrono::FixedOffset">FixedOffset</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub%3CMonths%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1695-1701">Source</a><a href="#impl-Sub%3CMonths%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><<a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Subtract <code>Months</code> from <code>DateTime</code>.</p>
</div></section></summary><div class="docblock"><p>The result will be clamped to valid days in the resulting month, see
<a href="struct.DateTime.html#method.checked_sub_months" title="method chrono::DateTime::checked_sub_months"><code>DateTime<Tz>::checked_sub_months</code></a> for details.</p>
<h4 id="panics-17"><a class="doc-anchor" href="#panics-17">§</a>Panics</h4>
<p>Panics 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>
<p>Strongly consider using <a href="struct.DateTime.html#method.checked_sub_months" title="method chrono::DateTime::checked_sub_months"><code>DateTime<Tz>::checked_sub_months</code></a> to get an <code>Option</code> instead.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-7" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1696">Source</a><a href="#associatedtype.Output-7" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.sub-3" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1698-1700">Source</a><a href="#method.sub-3" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, rhs: <a class="struct" href="struct.Months.html" title="struct chrono::Months">Months</a>) -> Self::<a class="associatedtype" href="https://doc.rust-lang.org/1.85.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.85.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%3CTimeDelta%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1595-1602">Source</a><a href="#impl-Sub%3CTimeDelta%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><<a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Subtract <code>TimeDelta</code> from <code>DateTime</code>.</p>
</div></section></summary><div class="docblock"><p>This is the same as the addition with a negated <code>TimeDelta</code>.</p>
<p>As a part of Chrono’s [leap second handling] the subtraction assumes that <strong>there is no leap
second ever</strong>, except when the <code>DateTime</code> itself represents a leap second in which case
the assumption becomes that <strong>there is exactly a single leap second ever</strong>.</p>
<h4 id="panics-12"><a class="doc-anchor" href="#panics-12">§</a>Panics</h4>
<p>Panics if the resulting date would be out of range.
Consider using <a href="struct.DateTime.html#method.checked_sub_signed" title="method chrono::DateTime::checked_sub_signed"><code>DateTime<Tz>::checked_sub_signed</code></a> to get an <code>Option</code> instead.</p>
</div><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-4" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1596">Source</a><a href="#associatedtype.Output-4" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>The resulting type after applying the <code>-</code> operator.</div></details><details class="toggle method-toggle" open><summary><section id="method.sub" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1599-1601">Source</a><a href="#method.sub" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, rhs: <a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>) -> <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Sub-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1703-1710">Source</a><a href="#impl-Sub-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Output-8" class="associatedtype trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1704">Source</a><a href="#associatedtype.Output-8" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</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-4" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1707-1709">Source</a><a href="#method.sub-4" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#tymethod.sub" class="fn">sub</a>(self, rhs: <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>) -> <a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a></h4></section></summary><div class='docblock'>Performs the <code>-</code> operation. <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html#tymethod.sub">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1657-1664">Source</a><a href="#impl-SubAssign%3CDuration%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.SubAssign.html" title="trait core::ops::arith::SubAssign">SubAssign</a><<a class="struct" href="https://doc.rust-lang.org/1.85.0/core/time/struct.Duration.html" title="struct core::time::Duration">Duration</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Subtract-assign <code>std::time::Duration</code> from <code>DateTime</code>.</p>
</div></section></summary><div class="docblock"><p>As a part of Chrono’s [leap second handling], the addition assumes that <strong>there is no leap
second ever</strong>, except when the <code>DateTime</code> itself represents a leap second in which case
the assumption becomes that <strong>there is exactly a single leap second ever</strong>.</p>
<h4 id="panics-15"><a class="doc-anchor" href="#panics-15">§</a>Panics</h4>
<p>Panics if the resulting date would be out of range.
Consider using <a href="struct.DateTime.html#method.checked_sub_signed" title="method chrono::DateTime::checked_sub_signed"><code>DateTime<Tz>::checked_sub_signed</code></a> to get an <code>Option</code> instead.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.sub_assign-1" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1659-1663">Source</a><a href="#method.sub_assign-1" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.SubAssign.html#tymethod.sub_assign" class="fn">sub_assign</a>(&mut self, rhs: <a class="struct" href="https://doc.rust-lang.org/1.85.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.85.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%3CTimeDelta%3E-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1637-1645">Source</a><a href="#impl-SubAssign%3CTimeDelta%3E-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.SubAssign.html" title="trait core::ops::arith::SubAssign">SubAssign</a><<a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3><div class="docblock"><p>Subtract-assign <code>TimeDelta</code> from <code>DateTime</code>.</p>
</div></section></summary><div class="docblock"><p>This is the same as the addition with a negated <code>TimeDelta</code>.</p>
<p>As a part of Chrono’s [leap second handling], the addition assumes that <strong>there is no leap
second ever</strong>, except when the <code>DateTime</code> itself represents a leap second in which case
the assumption becomes that <strong>there is exactly a single leap second ever</strong>.</p>
<h4 id="panics-14"><a class="doc-anchor" href="#panics-14">§</a>Panics</h4>
<p>Panics if the resulting date would be out of range.
Consider using <a href="struct.DateTime.html#method.checked_sub_signed" title="method chrono::DateTime::checked_sub_signed"><code>DateTime<Tz>::checked_sub_signed</code></a> to get an <code>Option</code> instead.</p>
</div><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.sub_assign" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1639-1644">Source</a><a href="#method.sub_assign" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.SubAssign.html#tymethod.sub_assign" class="fn">sub_assign</a>(&mut self, rhs: <a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>)</h4></section></summary><div class='docblock'>Performs the <code>-=</code> operation. <a href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.SubAssign.html#tymethod.sub_assign">Read more</a></div></details></div></details><details class="toggle implementors-toggle" open><summary><section id="impl-Timelike-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1329-1409">Source</a><a href="#impl-Timelike-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="trait.Timelike.html" title="trait chrono::Timelike">Timelike</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.with_hour" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1358-1360">Source</a><a href="#method.with_hour" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.with_hour" class="fn">with_hour</a>(&self, hour: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the hour number changed.</p>
<p>See also the <a href="struct.NaiveTime.html#method.with_hour" title="method chrono::NaiveTime::with_hour"><code>NaiveTime::with_hour</code></a> method.</p>
<h5 id="errors-19"><a class="doc-anchor" href="#errors-19">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The value for <code>hour</code> is invalid.</li>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_minute" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1372-1374">Source</a><a href="#method.with_minute" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.with_minute" class="fn">with_minute</a>(&self, min: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the minute number changed.</p>
<p>See also the <a href="struct.NaiveTime.html#method.with_minute" title="method chrono::NaiveTime::with_minute"><code>NaiveTime::with_minute</code></a> method.</p>
<h5 id="errors-20"><a class="doc-anchor" href="#errors-20">§</a>Errors</h5>
<ul>
<li>The value for <code>minute</code> is invalid.</li>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_second" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1390-1392">Source</a><a href="#method.with_second" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.with_second" class="fn">with_second</a>(&self, sec: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with the second number changed.</p>
<p>As with the <a href="#method.second"><code>second</code></a> method,
the input range is restricted to 0 through 59.</p>
<p>See also the <a href="struct.NaiveTime.html#method.with_second" title="method chrono::NaiveTime::with_second"><code>NaiveTime::with_second</code></a> method.</p>
<h5 id="errors-21"><a class="doc-anchor" href="#errors-21">§</a>Errors</h5>
<p>Returns <code>None</code> if:</p>
<ul>
<li>The value for <code>second</code> is invalid.</li>
<li>The local time at the resulting date does not exist or is ambiguous, for example during a
daylight saving time transition.</li>
</ul>
</div></details><details class="toggle method-toggle" open><summary><section id="method.with_nanosecond" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1406-1408">Source</a><a href="#method.with_nanosecond" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.with_nanosecond" class="fn">with_nanosecond</a>(&self, nano: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz>></h4></section></summary><div class="docblock"><p>Makes a new <code>DateTime</code> with nanoseconds since the whole non-leap second changed.</p>
<p>Returns <code>None</code> when the resulting <code>NaiveDateTime</code> would be invalid.
As with the <a href="struct.NaiveDateTime.html#method.nanosecond" title="method chrono::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="struct.NaiveTime.html#method.with_nanosecond" title="method chrono::NaiveTime::with_nanosecond"><code>NaiveTime::with_nanosecond</code></a> method.</p>
<h5 id="errors-22"><a class="doc-anchor" href="#errors-22">§</a>Errors</h5>
<p>Returns <code>None</code> if <code>nanosecond >= 2,000,000,000</code>.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.hour" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1331-1333">Source</a><a href="#method.hour" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.hour" class="fn">hour</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the hour number from 0 to 23.</div></details><details class="toggle method-toggle" open><summary><section id="method.minute" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1335-1337">Source</a><a href="#method.minute" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.minute" class="fn">minute</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the minute number from 0 to 59.</div></details><details class="toggle method-toggle" open><summary><section id="method.second" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1339-1341">Source</a><a href="#method.second" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.second" class="fn">second</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the second number from 0 to 59.</div></details><details class="toggle method-toggle" open><summary><section id="method.nanosecond" class="method trait-impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1343-1345">Source</a><a href="#method.nanosecond" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#tymethod.nanosecond" class="fn">nanosecond</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the number of nanoseconds since the whole non-leap second.
The range from 1,000,000,000 to 1,999,999,999 represents
the <a href="./naive/struct.NaiveTime.html#leap-second-handling">leap second</a>.</div></details><details class="toggle method-toggle" open><summary><section id="method.hour12" class="method trait-impl"><a class="src rightside" href="../src/chrono/traits.rs.html#278-285">Source</a><a href="#method.hour12" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#method.hour12" class="fn">hour12</a>(&self) -> (<a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.bool.html">bool</a>, <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a>)</h4></section></summary><div class='docblock'>Returns the hour number from 1 to 12 with a boolean flag,
which is false for AM and true for PM.</div></details><details class="toggle method-toggle" open><summary><section id="method.num_seconds_from_midnight" class="method trait-impl"><a class="src rightside" href="../src/chrono/traits.rs.html#329-331">Source</a><a href="#method.num_seconds_from_midnight" class="anchor">§</a><h4 class="code-header">fn <a href="trait.Timelike.html#method.num_seconds_from_midnight" class="fn">num_seconds_from_midnight</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u32.html">u32</a></h4></section></summary><div class='docblock'>Returns the number of non-leap seconds past the last midnight. <a href="trait.Timelike.html#method.num_seconds_from_midnight">Read more</a></div></details></div></details><section id="impl-Copy-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1413-1418">Source</a><a href="#impl-Copy-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
<Tz as <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>>::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>,
<a class="struct" href="struct.NaiveDateTime.html" title="struct chrono::NaiveDateTime">NaiveDateTime</a>: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Copy.html" title="trait core::marker::Copy">Copy</a>,</div></h3></section><section id="impl-Eq-for-DateTime%3CTz%3E" class="impl"><a class="src rightside" href="../src/chrono/datetime/mod.rs.html#1426">Source</a><a href="#impl-Eq-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz: <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz></h3></section></div><h2 id="synthetic-implementations" class="section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-Freeze-for-DateTime%3CTz%3E" class="impl"><a href="#impl-Freeze-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
<Tz as <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>>::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Freeze.html" title="trait core::marker::Freeze">Freeze</a>,</div></h3></section><section id="impl-RefUnwindSafe-for-DateTime%3CTz%3E" class="impl"><a href="#impl-RefUnwindSafe-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
<Tz as <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>>::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a>,</div></h3></section><section id="impl-Send-for-DateTime%3CTz%3E" class="impl"><a href="#impl-Send-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
<Tz as <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>>::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>,</div></h3></section><section id="impl-Sync-for-DateTime%3CTz%3E" class="impl"><a href="#impl-Sync-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
<Tz as <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>>::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>,</div></h3></section><section id="impl-Unpin-for-DateTime%3CTz%3E" class="impl"><a href="#impl-Unpin-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
<Tz as <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>>::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,</div></h3></section><section id="impl-UnwindSafe-for-DateTime%3CTz%3E" class="impl"><a href="#impl-UnwindSafe-for-DateTime%3CTz%3E" class="anchor">§</a><h3 class="code-header">impl<Tz> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Tz><div class="where">where
<Tz as <a class="trait" href="trait.TimeZone.html" title="trait chrono::TimeZone">TimeZone</a>>::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::TimeZone::Offset">Offset</a>: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a>,</div></h3></section></div><h2 id="blanket-implementations" class="section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/any.rs.html#138">Source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<div class="where">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/any.rs.html#139">Source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.85.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.85.0/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/borrow.rs.html#209">Source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/borrow.rs.html#211">Source</a><a href="#method.borrow" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/borrow/trait.Borrow.html#tymethod.borrow" class="fn">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.reference.html">&T</a></h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.85.0/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/borrow.rs.html#217">Source</a><a href="#impl-BorrowMut%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T<div class="where">where
T: ?<a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/borrow.rs.html#218">Source</a><a href="#method.borrow_mut" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fn">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.reference.html">&mut T</a></h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/1.85.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-CloneToUninit-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/clone.rs.html#273">Source</a><a href="#impl-CloneToUninit-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/clone/trait.CloneToUninit.html" title="trait core::clone::CloneToUninit">CloneToUninit</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone_to_uninit" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/clone.rs.html#275">Source</a><a href="#method.clone_to_uninit" class="anchor">§</a><h4 class="code-header">unsafe fn <a href="https://doc.rust-lang.org/1.85.0/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit" class="fn">clone_to_uninit</a>(&self, dst: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.pointer.html">*mut </a><a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u8.html">u8</a>)</h4></section></summary><span class="item-info"><div class="stab unstable"><span class="emoji">🔬</span><span>This is a nightly-only experimental API. (<code>clone_to_uninit</code>)</span></div></span><div class='docblock'>Performs copy-assignment from <code>self</code> to <code>dst</code>. <a href="https://doc.rust-lang.org/1.85.0/core/clone/trait.CloneToUninit.html#tymethod.clone_to_uninit">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/convert/mod.rs.html#767">Source</a><a href="#impl-From%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.from-9" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/convert/mod.rs.html#770">Source</a><a href="#method.from-9" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html#tymethod.from" class="fn">from</a>(t: T) -> T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/convert/mod.rs.html#750-752">Source</a><a href="#impl-Into%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/convert/mod.rs.html#760">Source</a><a href="#method.into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.Into.html#tymethod.into" class="fn">into</a>(self) -> U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for U</code> chooses to do.</p>
</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-SubsecRound-for-T" class="impl"><a class="src rightside" href="../src/chrono/round.rs.html#52-80">Source</a><a href="#impl-SubsecRound-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="round/trait.SubsecRound.html" title="trait chrono::round::SubsecRound">SubsecRound</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Add.html" title="trait core::ops::arith::Add">Add</a><<a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>, Output = T> + <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/ops/arith/trait.Sub.html" title="trait core::ops::arith::Sub">Sub</a><<a class="struct" href="struct.TimeDelta.html" title="struct chrono::TimeDelta">TimeDelta</a>, Output = T> + <a class="trait" href="trait.Timelike.html" title="trait chrono::Timelike">Timelike</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.round_subsecs" class="method trait-impl"><a class="src rightside" href="../src/chrono/round.rs.html#56-69">Source</a><a href="#method.round_subsecs" class="anchor">§</a><h4 class="code-header">fn <a href="round/trait.SubsecRound.html#tymethod.round_subsecs" class="fn">round_subsecs</a>(self, digits: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u16.html">u16</a>) -> T</h4></section></summary><div class='docblock'>Return a copy rounded to the specified number of subsecond digits. With
9 or more digits, self is returned unmodified. Halfway values are
rounded up (away from zero). <a href="round/trait.SubsecRound.html#tymethod.round_subsecs">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.trunc_subsecs" class="method trait-impl"><a class="src rightside" href="../src/chrono/round.rs.html#71-79">Source</a><a href="#method.trunc_subsecs" class="anchor">§</a><h4 class="code-header">fn <a href="round/trait.SubsecRound.html#tymethod.trunc_subsecs" class="fn">trunc_subsecs</a>(self, digits: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.u16.html">u16</a>) -> T</h4></section></summary><div class='docblock'>Return a copy truncated to the specified number of subsecond
digits. With 9 or more digits, self is returned unmodified. <a href="round/trait.SubsecRound.html#tymethod.trunc_subsecs">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToOwned-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/alloc/borrow.rs.html#82-84">Source</a><a href="#impl-ToOwned-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.85.0/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/alloc/borrow.rs.html#86">Source</a><a href="#associatedtype.Owned" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.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.85.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fn">to_owned</a>(&self) -> T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/1.85.0/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.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.85.0/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fn">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/1.85.0/std/primitive.reference.html">&mut T</a>)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/1.85.0/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-ToString-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/alloc/string.rs.html#2677">Source</a><a href="#impl-ToString-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="https://doc.rust-lang.org/1.85.0/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T<div class="where">where
T: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/1.85.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.to_string" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/alloc/string.rs.html#2679">Source</a><a href="#method.to_string" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/alloc/string/trait.ToString.html#tymethod.to_string" class="fn">to_string</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/1.85.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.85.0/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/convert/mod.rs.html#807-809">Source</a><a href="#impl-TryFrom%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/convert/mod.rs.html#811">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/convert/mod.rs.html#814">Source</a><a href="#method.try_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryFrom.html#tymethod.try_from" class="fn">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/convert/mod.rs.html#792-794">Source</a><a href="#impl-TryInto%3CU%3E-for-T" class="anchor">§</a><h3 class="code-header">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T<div class="where">where
U: <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>,</div></h3></section></summary><div class="impl-items"><details class="toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/convert/mod.rs.html#796">Source</a><a href="#associatedtype.Error" class="anchor">§</a><h4 class="code-header">type <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/1.85.0/src/core/convert/mod.rs.html#799">Source</a><a href="#method.try_into" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryInto.html#tymethod.try_into" class="fn">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/1.85.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="associatedtype" href="https://doc.rust-lang.org/1.85.0/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><section id="impl-DeserializeOwned-for-T" class="impl"><a class="src rightside" href="../src/serde/de/mod.rs.html#614">Source</a><a href="#impl-DeserializeOwned-for-T" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="../serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a> for T<div class="where">where
T: for<'de> <a class="trait" href="../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a><'de>,</div></h3></section></div></section></div></main></body></html>