180 lines
8.3 KiB
HTML
180 lines
8.3 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta name="generator" content="rustdoc">
|
||
<meta name="description" content="API documentation for the Rust `date` mod in crate `chrono`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, date">
|
||
|
||
<title>chrono::naive::date - Rust</title>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../../../normalize.css">
|
||
<link rel="stylesheet" type="text/css" href="../../../rustdoc.css">
|
||
<link rel="stylesheet" type="text/css" href="../../../main.css">
|
||
|
||
|
||
|
||
|
||
</head>
|
||
<body class="rustdoc mod">
|
||
<!--[if lte IE 8]>
|
||
<div class="warning">
|
||
This old browser is unsupported and will most likely display funky
|
||
things.
|
||
</div>
|
||
<![endif]-->
|
||
|
||
|
||
|
||
<nav class="sidebar">
|
||
|
||
<p class='location'>Module date</p><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#constants">Constants</a></li></ul></div><p class='location'><a href='../../index.html'>chrono</a>::<wbr><a href='../index.html'>naive</a></p><script>window.sidebarCurrent = {name: 'date', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script>
|
||
</nav>
|
||
|
||
<nav class="sub">
|
||
<form class="search-form js-only">
|
||
<div class="search-container">
|
||
<input class="search-input" name="search"
|
||
autocomplete="off"
|
||
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
|
||
type="search">
|
||
</div>
|
||
</form>
|
||
</nav>
|
||
|
||
<section id='main' class="content">
|
||
<h1 class='fqn'><span class='in-band'>Module <a href='../../index.html'>chrono</a>::<wbr><a href='../index.html'>naive</a>::<wbr><a class="mod" href=''>date</a></span><span class='out-of-band'><span id='render-detail'>
|
||
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
|
||
[<span class='inner'>−</span>]
|
||
</a>
|
||
</span><a class='srclink' href='../../../src/chrono/naive/date.rs.html#5-2805' title='goto source code'>[src]</a></span></h1>
|
||
<div class='docblock'><p>ISO 8601 calendar date without timezone.</p>
|
||
|
||
<h1 id='calendar-date' class='section-header'><a href='#calendar-date'>Calendar Date</a></h1>
|
||
<p>The ISO 8601 <strong>calendar date</strong> follows the proleptic Gregorian calendar.
|
||
It is like a normal civil calendar but note some slight differences:</p>
|
||
|
||
<ul>
|
||
<li><p>Dates before the Gregorian calendar's inception in 1582 are defined via the extrapolation.
|
||
Be careful, as historical dates are often noted in the Julian calendar and others
|
||
and the transition to Gregorian may differ across countries (as late as early 20C).</p>
|
||
|
||
<p>(Some example: Both Shakespeare from Britain and Cervantes from Spain seemingly died
|
||
on the same calendar date---April 23, 1616---but in the different calendar.
|
||
Britain used the Julian calendar at that time, so Shakespeare's death is later.)</p></li>
|
||
<li><p>ISO 8601 calendars has the year 0, which is 1 BCE (a year before 1 CE).
|
||
If you need a typical BCE/BC and CE/AD notation for year numbers,
|
||
use the <a href="../../trait.Datelike.html#method.year_ce"><code>Datelike::year_ce</code></a> method.</p></li>
|
||
</ul>
|
||
|
||
<h1 id='week-date' class='section-header'><a href='#week-date'>Week Date</a></h1>
|
||
<p>The ISO 8601 <strong>week date</strong> is a triple of year number, week number
|
||
and <a href="../../enum.Weekday.html">day of the week</a> with the following rules:</p>
|
||
|
||
<ul>
|
||
<li><p>A week consists of Monday through Sunday, and is always numbered within some year.
|
||
The week number ranges from 1 to 52 or 53 depending on the year.</p></li>
|
||
<li><p>The week 1 of given year is defined as the first week containing January 4 of that year,
|
||
or equivalently, the first week containing four or more days in that year.</p></li>
|
||
<li><p>The year number in the week date may <em>not</em> correspond to the actual Gregorian year.
|
||
For example, January 3, 2016 (Sunday) was on the last (53rd) week of 2015.</p></li>
|
||
</ul>
|
||
|
||
<p>Chrono's date types default to the ISO 8601 <a href="#calendar-date">calendar date</a>,
|
||
but the <a href="../../trait.Datelike.html#tymethod.isoweekdate"><code>Datelike::isoweekdate</code></a> method
|
||
can be used to get the corresponding week date.</p>
|
||
|
||
<h1 id='ordinal-date' class='section-header'><a href='#ordinal-date'>Ordinal Date</a></h1>
|
||
<p>The ISO 8601 <strong>ordinal date</strong> is a pair of year number and day of the year ("ordinal").
|
||
The ordinal number ranges from 1 to 365 or 366 depending on the year.
|
||
The year number is same to that of the <a href="#calendar-date">calendar date</a>.</p>
|
||
|
||
<p>This is currently the internal format of Chrono's date types.</p>
|
||
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
|
||
<table>
|
||
<tr class=' module-item'>
|
||
<td><a class="struct" href="struct.NaiveDate.html"
|
||
title='struct chrono::naive::date::NaiveDate'>NaiveDate</a></td>
|
||
<td class='docblock-short'>
|
||
<p>ISO 8601 calendar date without timezone.
|
||
Allows for every <a href="./index.html#calendar-date">proleptic Gregorian date</a>
|
||
from Jan 1, 262145 BCE to Dec 31, 262143 CE.
|
||
Also supports the conversion from ISO 8601 ordinal and week date.</p>
|
||
</td>
|
||
</tr></table><h2 id='constants' class='section-header'><a href="#constants">Constants</a></h2>
|
||
<table>
|
||
<tr class=' module-item'>
|
||
<td><a class="constant" href="constant.MAX.html"
|
||
title='constant chrono::naive::date::MAX'>MAX</a></td>
|
||
<td class='docblock-short'>
|
||
<p>The maximum possible <code>NaiveDate</code> (December 31, 262143 CE).</p>
|
||
</td>
|
||
</tr>
|
||
<tr class=' module-item'>
|
||
<td><a class="constant" href="constant.MIN.html"
|
||
title='constant chrono::naive::date::MIN'>MIN</a></td>
|
||
<td class='docblock-short'>
|
||
<p>The minimum possible <code>NaiveDate</code> (January 1, 262145 BCE).</p>
|
||
</td>
|
||
</tr></table></section>
|
||
<section id='search' class="content hidden"></section>
|
||
|
||
<section class="footer"></section>
|
||
|
||
<aside id="help" class="hidden">
|
||
<div>
|
||
<h1 class="hidden">Help</h1>
|
||
|
||
<div class="shortcuts">
|
||
<h2>Keyboard Shortcuts</h2>
|
||
|
||
<dl>
|
||
<dt>?</dt>
|
||
<dd>Show this help dialog</dd>
|
||
<dt>S</dt>
|
||
<dd>Focus the search field</dd>
|
||
<dt>⇤</dt>
|
||
<dd>Move up in search results</dd>
|
||
<dt>⇥</dt>
|
||
<dd>Move down in search results</dd>
|
||
<dt>⏎</dt>
|
||
<dd>Go to active search result</dd>
|
||
<dt>+</dt>
|
||
<dd>Collapse/expand all sections</dd>
|
||
</dl>
|
||
</div>
|
||
|
||
<div class="infos">
|
||
<h2>Search Tricks</h2>
|
||
|
||
<p>
|
||
Prefix searches with a type followed by a colon (e.g.
|
||
<code>fn:</code>) to restrict the search to a given type.
|
||
</p>
|
||
|
||
<p>
|
||
Accepted types are: <code>fn</code>, <code>mod</code>,
|
||
<code>struct</code>, <code>enum</code>,
|
||
<code>trait</code>, <code>type</code>, <code>macro</code>,
|
||
and <code>const</code>.
|
||
</p>
|
||
|
||
<p>
|
||
Search functions by type signature (e.g.
|
||
<code>vec -> usize</code> or <code>* -> vec</code>)
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
|
||
|
||
|
||
<script>
|
||
window.rootPath = "../../../";
|
||
window.currentCrate = "chrono";
|
||
</script>
|
||
<script src="../../../main.js"></script>
|
||
<script defer src="../../../search-index.js"></script>
|
||
</body>
|
||
</html> |