forked from diesel-rs/diesel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrait.TimeZone.html
More file actions
151 lines (142 loc) · 47 KB
/
Copy pathtrait.TimeZone.html
File metadata and controls
151 lines (142 loc) · 47 KB
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
<!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="The time zone."><meta name="keywords" content="rust, rustlang, rust-lang, TimeZone"><title>TimeZone in chrono::offset - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../main.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../chrono/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div>
</a><h2 class="location"></h2>
</nav>
<nav class="sidebar"><a class="sidebar-logo" href="../../chrono/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div>
</a><h2 class="location"><a href="#">TimeZone</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#required-associated-types">Required Associated Types</a></h3><ul><li><a href="#associatedtype.Offset">Offset</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#required-methods">Required Methods</a></h3><ul><li><a href="#tymethod.from_offset">from_offset</a></li><li><a href="#tymethod.offset_from_local_date">offset_from_local_date</a></li><li><a href="#tymethod.offset_from_local_datetime">offset_from_local_datetime</a></li><li><a href="#tymethod.offset_from_utc_date">offset_from_utc_date</a></li><li><a href="#tymethod.offset_from_utc_datetime">offset_from_utc_datetime</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#provided-methods">Provided Methods</a></h3><ul><li><a href="#method.datetime_from_str">datetime_from_str</a></li><li><a href="#method.from_local_date">from_local_date</a></li><li><a href="#method.from_local_datetime">from_local_datetime</a></li><li><a href="#method.from_utc_date">from_utc_date</a></li><li><a href="#method.from_utc_datetime">from_utc_datetime</a></li><li><a href="#method.isoywd">isoywd</a></li><li><a href="#method.isoywd_opt">isoywd_opt</a></li><li><a href="#method.timestamp">timestamp</a></li><li><a href="#method.timestamp_millis">timestamp_millis</a></li><li><a href="#method.timestamp_millis_opt">timestamp_millis_opt</a></li><li><a href="#method.timestamp_nanos">timestamp_nanos</a></li><li><a href="#method.timestamp_opt">timestamp_opt</a></li><li><a href="#method.ymd">ymd</a></li><li><a href="#method.ymd_opt">ymd_opt</a></li><li><a href="#method.yo">yo</a></li><li><a href="#method.yo_opt">yo_opt</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div></section><h2 class="location"><a href="index.html">In chrono::offset</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../chrono/index.html"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1">
<a href="../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../wheel.svg"></a></div>
</div></form></nav></div><section id="main-content" class="content"><div class="main-heading">
<h1 class="fqn"><span class="in-band">Trait <a href="../index.html">chrono</a>::<wbr><a href="index.html">offset</a>::<wbr><a class="trait" href="#">TimeZone</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#192-462">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="docblock item-decl"><pre class="rust trait"><code>pub trait TimeZone: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> {
type <a href="#associatedtype.Offset" class="associatedtype">Offset</a>: <a class="trait" href="trait.Offset.html" title="trait chrono::offset::Offset">Offset</a>;
<details class="rustdoc-toggle type-contents-toggle"><summary class="hideme"><span>Show 21 methods</span></summary> fn <a href="#tymethod.from_offset" class="fnname">from_offset</a>(offset: &Self::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>) -> Self;
<span class="item-spacer"></span> fn <a href="#tymethod.offset_from_local_date" class="fnname">offset_from_local_date</a>(<br> &self, <br> local: &<a class="struct" href="../naive/struct.NaiveDate.html" title="struct chrono::naive::NaiveDate">NaiveDate</a><br> ) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><Self::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>>;
<span class="item-spacer"></span> fn <a href="#tymethod.offset_from_local_datetime" class="fnname">offset_from_local_datetime</a>(<br> &self, <br> local: &<a class="struct" href="../naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a><br> ) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><Self::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>>;
<span class="item-spacer"></span> fn <a href="#tymethod.offset_from_utc_date" class="fnname">offset_from_utc_date</a>(&self, utc: &<a class="struct" href="../naive/struct.NaiveDate.html" title="struct chrono::naive::NaiveDate">NaiveDate</a>) -> Self::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>;
<span class="item-spacer"></span> fn <a href="#tymethod.offset_from_utc_datetime" class="fnname">offset_from_utc_datetime</a>(&self, utc: &<a class="struct" href="../naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a>) -> Self::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>;
fn <a href="#method.ymd" class="fnname">ymd</a>(&self, year: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, month: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, day: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self> { ... }
<span class="item-spacer"></span> fn <a href="#method.ymd_opt" class="fnname">ymd_opt</a>(<br> &self, <br> year: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, <br> month: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <br> day: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><br> ) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self>> { ... }
<span class="item-spacer"></span> fn <a href="#method.yo" class="fnname">yo</a>(&self, year: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, ordinal: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self> { ... }
<span class="item-spacer"></span> fn <a href="#method.yo_opt" class="fnname">yo_opt</a>(&self, year: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, ordinal: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self>> { ... }
<span class="item-spacer"></span> fn <a href="#method.isoywd" class="fnname">isoywd</a>(&self, year: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, week: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, weekday: <a class="enum" href="../enum.Weekday.html" title="enum chrono::Weekday">Weekday</a>) -> <a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self> { ... }
<span class="item-spacer"></span> fn <a href="#method.isoywd_opt" class="fnname">isoywd_opt</a>(<br> &self, <br> year: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, <br> week: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <br> weekday: <a class="enum" href="../enum.Weekday.html" title="enum chrono::Weekday">Weekday</a><br> ) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self>> { ... }
<span class="item-spacer"></span> fn <a href="#method.timestamp" class="fnname">timestamp</a>(&self, secs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, nsecs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self> { ... }
<span class="item-spacer"></span> fn <a href="#method.timestamp_opt" class="fnname">timestamp_opt</a>(<br> &self, <br> secs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, <br> nsecs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a><br> ) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self>> { ... }
<span class="item-spacer"></span> fn <a href="#method.timestamp_millis" class="fnname">timestamp_millis</a>(&self, millis: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self> { ... }
<span class="item-spacer"></span> fn <a href="#method.timestamp_millis_opt" class="fnname">timestamp_millis_opt</a>(&self, millis: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self>> { ... }
<span class="item-spacer"></span> fn <a href="#method.timestamp_nanos" class="fnname">timestamp_nanos</a>(&self, nanos: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self> { ... }
<span class="item-spacer"></span> fn <a href="#method.datetime_from_str" class="fnname">datetime_from_str</a>(<br> &self, <br> s: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <br> fmt: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a><br> ) -> <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><Self>> { ... }
<span class="item-spacer"></span> fn <a href="#method.from_local_date" class="fnname">from_local_date</a>(&self, local: &<a class="struct" href="../naive/struct.NaiveDate.html" title="struct chrono::naive::NaiveDate">NaiveDate</a>) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self>> { ... }
<span class="item-spacer"></span> fn <a href="#method.from_local_datetime" class="fnname">from_local_datetime</a>(<br> &self, <br> local: &<a class="struct" href="../naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a><br> ) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self>> { ... }
<span class="item-spacer"></span> fn <a href="#method.from_utc_date" class="fnname">from_utc_date</a>(&self, utc: &<a class="struct" href="../naive/struct.NaiveDate.html" title="struct chrono::naive::NaiveDate">NaiveDate</a>) -> <a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self> { ... }
<span class="item-spacer"></span> fn <a href="#method.from_utc_datetime" class="fnname">from_utc_datetime</a>(&self, utc: &<a class="struct" href="../naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a>) -> <a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self> { ... }
</details>}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The time zone.</p>
<p>The methods here are the primarily constructors for <a href="../struct.Date.html"><code>Date</code></a> and
<a href="../struct.DateTime.html"><code>DateTime</code></a> types.</p>
</div></details><h2 id="required-associated-types" class="small-section-header">Required Associated Types<a href="#required-associated-types" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Offset" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#196">source</a></div><h4 class="code-header">type <a href="#associatedtype.Offset" class="associatedtype">Offset</a>: <a class="trait" href="trait.Offset.html" title="trait chrono::offset::Offset">Offset</a></h4></div></summary><div class="docblock"><p>An associated offset type.
This type is used to store the actual offset in date and time types.
The original <code>TimeZone</code> value can be recovered via <code>TimeZone::from_offset</code>.</p>
</div></details></div><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.from_offset" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#423">source</a></div><h4 class="code-header">fn <a href="#tymethod.from_offset" class="fnname">from_offset</a>(offset: &Self::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>) -> Self</h4></div></summary><div class="docblock"><p>Reconstructs the time zone from the offset.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.offset_from_local_date" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#426">source</a></div><h4 class="code-header">fn <a href="#tymethod.offset_from_local_date" class="fnname">offset_from_local_date</a>(&self, local: &<a class="struct" href="../naive/struct.NaiveDate.html" title="struct chrono::naive::NaiveDate">NaiveDate</a>) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><Self::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>></h4></div></summary><div class="docblock"><p>Creates the offset(s) for given local <code>NaiveDate</code> if possible.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.offset_from_local_datetime" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#429">source</a></div><h4 class="code-header">fn <a href="#tymethod.offset_from_local_datetime" class="fnname">offset_from_local_datetime</a>(<br> &self, <br> local: &<a class="struct" href="../naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a><br>) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><Self::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a>></h4></div></summary><div class="docblock"><p>Creates the offset(s) for given local <code>NaiveDateTime</code> if possible.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.offset_from_utc_date" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#446">source</a></div><h4 class="code-header">fn <a href="#tymethod.offset_from_utc_date" class="fnname">offset_from_utc_date</a>(&self, utc: &<a class="struct" href="../naive/struct.NaiveDate.html" title="struct chrono::naive::NaiveDate">NaiveDate</a>) -> Self::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a></h4></div></summary><div class="docblock"><p>Creates the offset for given UTC <code>NaiveDate</code>. This cannot fail.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.offset_from_utc_datetime" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#449">source</a></div><h4 class="code-header">fn <a href="#tymethod.offset_from_utc_datetime" class="fnname">offset_from_utc_datetime</a>(&self, utc: &<a class="struct" href="../naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a>) -> Self::<a class="associatedtype" href="trait.TimeZone.html#associatedtype.Offset" title="type chrono::offset::TimeZone::Offset">Offset</a></h4></div></summary><div class="docblock"><p>Creates the offset for given UTC <code>NaiveDateTime</code>. This cannot fail.</p>
</div></details></div><h2 id="provided-methods" class="small-section-header">Provided Methods<a href="#provided-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="method.ymd" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#213-215">source</a></div><h4 class="code-header">fn <a href="#method.ymd" class="fnname">ymd</a>(&self, year: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, month: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, day: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self></h4></div></summary><div class="docblock"><p>Makes a new <code>Date</code> from year, month, day and the current time zone.
This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE.</p>
<p>The time zone normally does not affect the date (unless it is between UTC-24 and UTC+24),
but it will propagate to the <code>DateTime</code> values constructed via this date.</p>
<p>Panics on the out-of-range date, invalid month and/or day.</p>
<h5 id="example"><a href="#example">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">chrono</span>::{<span class="ident">Utc</span>, <span class="ident">TimeZone</span>};
<span class="macro">assert_eq!</span>(<span class="ident">Utc</span>.<span class="ident">ymd</span>(<span class="number">2015</span>, <span class="number">5</span>, <span class="number">15</span>).<span class="ident">to_string</span>(), <span class="string">"2015-05-15UTC"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.ymd_opt" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#233-238">source</a></div><h4 class="code-header">fn <a href="#method.ymd_opt" class="fnname">ymd_opt</a>(&self, year: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, month: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, day: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self>></h4></div></summary><div class="docblock"><p>Makes a new <code>Date</code> from year, month, day and the current time zone.
This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE.</p>
<p>The time zone normally does not affect the date (unless it is between UTC-24 and UTC+24),
but it will propagate to the <code>DateTime</code> values constructed via this date.</p>
<p>Returns <code>None</code> on the out-of-range date, invalid month and/or day.</p>
<h5 id="example-1"><a href="#example-1">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">chrono</span>::{<span class="ident">Utc</span>, <span class="ident">LocalResult</span>, <span class="ident">TimeZone</span>};
<span class="macro">assert_eq!</span>(<span class="ident">Utc</span>.<span class="ident">ymd_opt</span>(<span class="number">2015</span>, <span class="number">5</span>, <span class="number">15</span>).<span class="ident">unwrap</span>().<span class="ident">to_string</span>(), <span class="string">"2015-05-15UTC"</span>);
<span class="macro">assert_eq!</span>(<span class="ident">Utc</span>.<span class="ident">ymd_opt</span>(<span class="number">2000</span>, <span class="number">0</span>, <span class="number">0</span>), <span class="ident">LocalResult::None</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.yo" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#255-257">source</a></div><h4 class="code-header">fn <a href="#method.yo" class="fnname">yo</a>(&self, year: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, ordinal: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self></h4></div></summary><div class="docblock"><p>Makes a new <code>Date</code> from year, day of year (DOY or “ordinal”) and the current time zone.
This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE.</p>
<p>The time zone normally does not affect the date (unless it is between UTC-24 and UTC+24),
but it will propagate to the <code>DateTime</code> values constructed via this date.</p>
<p>Panics on the out-of-range date and/or invalid DOY.</p>
<h5 id="example-2"><a href="#example-2">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">chrono</span>::{<span class="ident">Utc</span>, <span class="ident">TimeZone</span>};
<span class="macro">assert_eq!</span>(<span class="ident">Utc</span>.<span class="ident">yo</span>(<span class="number">2015</span>, <span class="number">135</span>).<span class="ident">to_string</span>(), <span class="string">"2015-05-15UTC"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.yo_opt" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#266-271">source</a></div><h4 class="code-header">fn <a href="#method.yo_opt" class="fnname">yo_opt</a>(&self, year: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, ordinal: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self>></h4></div></summary><div class="docblock"><p>Makes a new <code>Date</code> from year, day of year (DOY or “ordinal”) and the current time zone.
This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE.</p>
<p>The time zone normally does not affect the date (unless it is between UTC-24 and UTC+24),
but it will propagate to the <code>DateTime</code> values constructed via this date.</p>
<p>Returns <code>None</code> on the out-of-range date and/or invalid DOY.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.isoywd" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#290-292">source</a></div><h4 class="code-header">fn <a href="#method.isoywd" class="fnname">isoywd</a>(&self, year: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, week: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, weekday: <a class="enum" href="../enum.Weekday.html" title="enum chrono::Weekday">Weekday</a>) -> <a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self></h4></div></summary><div class="docblock"><p>Makes a new <code>Date</code> from ISO week date (year and week number), day of the week (DOW) and
the current time zone.
This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE.
The resulting <code>Date</code> may have a different year from the input year.</p>
<p>The time zone normally does not affect the date (unless it is between UTC-24 and UTC+24),
but it will propagate to the <code>DateTime</code> values constructed via this date.</p>
<p>Panics on the out-of-range date and/or invalid week number.</p>
<h5 id="example-3"><a href="#example-3">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">chrono</span>::{<span class="ident">Utc</span>, <span class="ident">Weekday</span>, <span class="ident">TimeZone</span>};
<span class="macro">assert_eq!</span>(<span class="ident">Utc</span>.<span class="ident">isoywd</span>(<span class="number">2015</span>, <span class="number">20</span>, <span class="ident">Weekday::Fri</span>).<span class="ident">to_string</span>(), <span class="string">"2015-05-15UTC"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.isoywd_opt" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#303-308">source</a></div><h4 class="code-header">fn <a href="#method.isoywd_opt" class="fnname">isoywd_opt</a>(<br> &self, <br> year: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i32.html">i32</a>, <br> week: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>, <br> weekday: <a class="enum" href="../enum.Weekday.html" title="enum chrono::Weekday">Weekday</a><br>) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self>></h4></div></summary><div class="docblock"><p>Makes a new <code>Date</code> from ISO week date (year and week number), day of the week (DOW) and
the current time zone.
This assumes the proleptic Gregorian calendar, with the year 0 being 1 BCE.
The resulting <code>Date</code> may have a different year from the input year.</p>
<p>The time zone normally does not affect the date (unless it is between UTC-24 and UTC+24),
but it will propagate to the <code>DateTime</code> values constructed via this date.</p>
<p>Returns <code>None</code> on the out-of-range date and/or invalid week number.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.timestamp" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#324-326">source</a></div><h4 class="code-header">fn <a href="#method.timestamp" class="fnname">timestamp</a>(&self, secs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, nsecs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self></h4></div></summary><div class="docblock"><p>Makes a new <code>DateTime</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>Panics on the out-of-range number of seconds and/or invalid nanosecond,
for a non-panicking version see <a href="#method.timestamp_opt"><code>timestamp_opt</code></a>.</p>
<h5 id="example-4"><a href="#example-4">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">chrono</span>::{<span class="ident">Utc</span>, <span class="ident">TimeZone</span>};
<span class="macro">assert_eq!</span>(<span class="ident">Utc</span>.<span class="ident">timestamp</span>(<span class="number">1431648000</span>, <span class="number">0</span>).<span class="ident">to_string</span>(), <span class="string">"2015-05-15 00:00:00 UTC"</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.timestamp_opt" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#334-339">source</a></div><h4 class="code-header">fn <a href="#method.timestamp_opt" class="fnname">timestamp_opt</a>(&self, secs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>, nsecs: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u32.html">u32</a>) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self>></h4></div></summary><div class="docblock"><p>Makes a new <code>DateTime</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>Returns <code>LocalResult::None</code> on out-of-range number of seconds and/or
invalid nanosecond, otherwise always returns <code>LocalResult::Single</code>.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.timestamp_millis" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#354-356">source</a></div><h4 class="code-header">fn <a href="#method.timestamp_millis" class="fnname">timestamp_millis</a>(&self, millis: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self></h4></div></summary><div class="docblock"><p>Makes a new <code>DateTime</code> from the number of non-leap milliseconds
since January 1, 1970 0:00:00 UTC (aka “UNIX timestamp”).</p>
<p>Panics on out-of-range number of milliseconds for a non-panicking
version see <a href="#method.timestamp_millis_opt"><code>timestamp_millis_opt</code></a>.</p>
<h5 id="example-5"><a href="#example-5">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">chrono</span>::{<span class="ident">Utc</span>, <span class="ident">TimeZone</span>};
<span class="macro">assert_eq!</span>(<span class="ident">Utc</span>.<span class="ident">timestamp_millis</span>(<span class="number">1431648000</span>).<span class="ident">timestamp</span>(), <span class="number">1431648</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.timestamp_millis_opt" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#375-382">source</a></div><h4 class="code-header">fn <a href="#method.timestamp_millis_opt" class="fnname">timestamp_millis_opt</a>(&self, millis: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self>></h4></div></summary><div class="docblock"><p>Makes a new <code>DateTime</code> from the number of non-leap milliseconds
since January 1, 1970 0:00:00 UTC (aka “UNIX timestamp”).</p>
<p>Returns <code>LocalResult::None</code> on out-of-range number of milliseconds
and/or invalid nanosecond, otherwise always returns
<code>LocalResult::Single</code>.</p>
<h5 id="example-6"><a href="#example-6">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">chrono</span>::{<span class="ident">Utc</span>, <span class="ident">TimeZone</span>, <span class="ident">LocalResult</span>};
<span class="kw">match</span> <span class="ident">Utc</span>.<span class="ident">timestamp_millis_opt</span>(<span class="number">1431648000</span>) {
<span class="ident">LocalResult::Single</span>(<span class="ident">dt</span>) => <span class="macro">assert_eq!</span>(<span class="ident">dt</span>.<span class="ident">timestamp</span>(), <span class="number">1431648</span>),
<span class="kw">_</span> => <span class="macro">panic!</span>(<span class="string">"Incorrect timestamp_millis"</span>),
};</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.timestamp_nanos" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#397-404">source</a></div><h4 class="code-header">fn <a href="#method.timestamp_nanos" class="fnname">timestamp_nanos</a>(&self, nanos: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.i64.html">i64</a>) -> <a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self></h4></div></summary><div class="docblock"><p>Makes a new <code>DateTime</code> from the number of non-leap nanoseconds
since January 1, 1970 0:00:00 UTC (aka “UNIX timestamp”).</p>
<p>Unlike <a href="#method.timestamp_millis"><code>timestamp_millis</code></a>, this never
panics.</p>
<h5 id="example-7"><a href="#example-7">Example</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">chrono</span>::{<span class="ident">Utc</span>, <span class="ident">TimeZone</span>};
<span class="macro">assert_eq!</span>(<span class="ident">Utc</span>.<span class="ident">timestamp_nanos</span>(<span class="number">1431648000000000</span>).<span class="ident">timestamp</span>(), <span class="number">1431648</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.datetime_from_str" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#416-420">source</a></div><h4 class="code-header">fn <a href="#method.datetime_from_str" class="fnname">datetime_from_str</a>(&self, s: &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, fmt: &<a class="primitive" href="https://doc.rust-lang.org/nightly/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><Self>></h4></div></summary><div class="docblock"><p>Parses a string with the specified format string and
returns a <code>DateTime</code> with the current offset.
See the <a href="../format/strftime/index.html"><code>format::strftime</code> module</a>
on the supported escape sequences.</p>
<p>If the format does not include offsets, the current offset is assumed;
otherwise the input should have a matching UTC offset.</p>
<p>See also <code>DateTime::parse_from_str</code> which gives a local <code>DateTime</code>
with parsed <code>FixedOffset</code>.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.from_local_date" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#432-437">source</a></div><h4 class="code-header">fn <a href="#method.from_local_date" class="fnname">from_local_date</a>(&self, local: &<a class="struct" href="../naive/struct.NaiveDate.html" title="struct chrono::naive::NaiveDate">NaiveDate</a>) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self>></h4></div></summary><div class="docblock"><p>Converts the local <code>NaiveDate</code> to the timezone-aware <code>Date</code> if possible.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.from_local_datetime" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#440-443">source</a></div><h4 class="code-header">fn <a href="#method.from_local_datetime" class="fnname">from_local_datetime</a>(<br> &self, <br> local: &<a class="struct" href="../naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a><br>) -> <a class="enum" href="enum.LocalResult.html" title="enum chrono::offset::LocalResult">LocalResult</a><<a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self>></h4></div></summary><div class="docblock"><p>Converts the local <code>NaiveDateTime</code> to the timezone-aware <code>DateTime</code> if possible.</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.from_utc_date" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#453-455">source</a></div><h4 class="code-header">fn <a href="#method.from_utc_date" class="fnname">from_utc_date</a>(&self, utc: &<a class="struct" href="../naive/struct.NaiveDate.html" title="struct chrono::naive::NaiveDate">NaiveDate</a>) -> <a class="struct" href="../struct.Date.html" title="struct chrono::Date">Date</a><Self></h4></div></summary><div class="docblock"><p>Converts the UTC <code>NaiveDate</code> to the local time.
The UTC is continuous and thus this cannot fail (but can give the duplicate local time).</p>
</div></details><details class="rustdoc-toggle" open><summary><div id="method.from_utc_datetime" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/chrono/offset/mod.rs.html#459-461">source</a></div><h4 class="code-header">fn <a href="#method.from_utc_datetime" class="fnname">from_utc_datetime</a>(&self, utc: &<a class="struct" href="../naive/struct.NaiveDateTime.html" title="struct chrono::naive::NaiveDateTime">NaiveDateTime</a>) -> <a class="struct" href="../struct.DateTime.html" title="struct chrono::DateTime">DateTime</a><Self></h4></div></summary><div class="docblock"><p>Converts the UTC <code>NaiveDateTime</code> to the local time.
The UTC is continuous and thus this cannot fail (but can give the duplicate local time).</p>
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TimeZone" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../../src/chrono/offset/fixed.rs.html#101-121">source</a></span><a href="#impl-TimeZone" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a> for <a class="struct" href="struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Offset-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Offset-1" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Offset" class="associatedtype">Offset</a> = <a class="struct" href="struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TimeZone-1" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../../src/chrono/offset/local.rs.html#117-194">source</a></span><a href="#impl-TimeZone-1" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a> for <a class="struct" href="struct.Local.html" title="struct chrono::offset::Local">Local</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Offset-2" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Offset-2" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Offset" class="associatedtype">Offset</a> = <a class="struct" href="struct.FixedOffset.html" title="struct chrono::offset::FixedOffset">FixedOffset</a></h4></section></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TimeZone-2" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../../src/chrono/offset/utc.rs.html#62-82">source</a></span><a href="#impl-TimeZone-2" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.TimeZone.html" title="trait chrono::offset::TimeZone">TimeZone</a> for <a class="struct" href="struct.Utc.html" title="struct chrono::offset::Utc">Utc</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Offset-3" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Offset-3" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Offset" class="associatedtype">Offset</a> = <a class="struct" href="struct.Utc.html" title="struct chrono::offset::Utc">Utc</a></h4></section></div></details></div><script type="text/javascript" src="../../implementors/chrono/offset/trait.TimeZone.js" data-ignore-extern-crates="" async></script></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="chrono" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (495b21669 2022-07-03)" ></div>
</body></html>