Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="module-time.html" /> | |
13 | <link rel="prev" href="module-popen2.html" /> | |
14 | <link rel="parent" href="allos.html" /> | |
15 | <link rel="next" href="node251.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>6.10 datetime -- Basic date and time types</title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="6.9.2 Flow Control Issues" | |
25 | href="popen2-flow-control.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="6. Generic Operating System" | |
28 | href="allos.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="6.10.1 Available Types" | |
31 | href="node251.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="popen2-flow-control.html">6.9.2 Flow Control Issues</A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="allos.html">6. Generic Operating System</A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="node251.html">6.10.1 Available Types</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H1><A NAME="SECTION0081000000000000000000"> | |
56 | 6.10 <tt class="module">datetime</tt> -- | |
57 | Basic date and time types</A> | |
58 | </H1> | |
59 | ||
60 | <P> | |
61 | <A NAME="module-datetime"></A> | |
62 | ||
63 | <P> | |
64 | ||
65 | <span class="versionnote">New in version 2.3.</span> | |
66 | ||
67 | <P> | |
68 | The <tt class="module">datetime</tt> module supplies classes for manipulating dates | |
69 | and times in both simple and complex ways. While date and time | |
70 | arithmetic is supported, the focus of the implementation is on | |
71 | efficient member extraction for output formatting and manipulation. | |
72 | ||
73 | <P> | |
74 | There are two kinds of date and time objects: ``naive'' and ``aware''. | |
75 | This distinction refers to whether the object has any notion of time | |
76 | zone, daylight saving time, or other kind of algorithmic or political | |
77 | time adjustment. Whether a naive <tt class="class">datetime</tt> object represents | |
78 | Coordinated Universal Time (UTC), local time, or time in some other | |
79 | timezone is purely up to the program, just like it's up to the program | |
80 | whether a particular number represents metres, miles, or mass. Naive | |
81 | <tt class="class">datetime</tt> objects are easy to understand and to work with, at | |
82 | the cost of ignoring some aspects of reality. | |
83 | ||
84 | <P> | |
85 | For applications requiring more, <tt class="class">datetime</tt> and <tt class="class">time</tt> | |
86 | objects have an optional time zone information member, | |
87 | <tt class="member">tzinfo</tt>, that can contain an instance of a subclass of | |
88 | the abstract <tt class="class">tzinfo</tt> class. These <tt class="class">tzinfo</tt> objects | |
89 | capture information about the offset from UTC time, the time zone | |
90 | name, and whether Daylight Saving Time is in effect. Note that no | |
91 | concrete <tt class="class">tzinfo</tt> classes are supplied by the <tt class="module">datetime</tt> | |
92 | module. Supporting timezones at whatever level of detail is required | |
93 | is up to the application. The rules for time adjustment across the | |
94 | world are more political than rational, and there is no standard | |
95 | suitable for every application. | |
96 | ||
97 | <P> | |
98 | The <tt class="module">datetime</tt> module exports the following constants: | |
99 | ||
100 | <P> | |
101 | <dl><dt><b><tt id='l2h-1856' xml:id='l2h-1856'>MINYEAR</tt></b></dt> | |
102 | <dd> | |
103 | The smallest year number allowed in a <tt class="class">date</tt> or | |
104 | <tt class="class">datetime</tt> object. <tt class="constant">MINYEAR</tt> | |
105 | is <code>1</code>. | |
106 | </dd></dl> | |
107 | ||
108 | <P> | |
109 | <dl><dt><b><tt id='l2h-1857' xml:id='l2h-1857'>MAXYEAR</tt></b></dt> | |
110 | <dd> | |
111 | The largest year number allowed in a <tt class="class">date</tt> or <tt class="class">datetime</tt> | |
112 | object. <tt class="constant">MAXYEAR</tt> is <code>9999</code>. | |
113 | </dd></dl> | |
114 | ||
115 | <P> | |
116 | <div class="seealso"> | |
117 | <p class="heading">See Also:</p> | |
118 | ||
119 | <dl compact="compact" class="seemodule"> | |
120 | <dt>Module <b><tt class="module"><a href="module-calendar.html">calendar</a></tt>:</b> | |
121 | <dd>General calendar related functions. | |
122 | </dl> | |
123 | <dl compact="compact" class="seemodule"> | |
124 | <dt>Module <b><tt class="module"><a href="module-time.html">time</a></tt>:</b> | |
125 | <dd>Time access and conversions. | |
126 | </dl> | |
127 | </div> | |
128 | ||
129 | <P> | |
130 | ||
131 | <p><br /></p><hr class='online-navigation' /> | |
132 | <div class='online-navigation'> | |
133 | <!--Table of Child-Links--> | |
134 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> | |
135 | ||
136 | <UL CLASS="ChildLinks"> | |
137 | <LI><A href="node251.html">6.10.1 Available Types</a> | |
138 | <LI><A href="datetime-timedelta.html">6.10.2 <tt class="class">timedelta</tt> Objects</a> | |
139 | <LI><A href="datetime-date.html">6.10.3 <tt class="class">date</tt> Objects</a> | |
140 | <LI><A href="datetime-datetime.html">6.10.4 <tt class="class">datetime</tt> Objects</a> | |
141 | <LI><A href="datetime-time.html">6.10.5 <tt class="class">time</tt> Objects</a> | |
142 | <LI><A href="datetime-tzinfo.html">6.10.6 <tt class="class">tzinfo</tt> Objects</a> | |
143 | <LI><A href="node257.html">6.10.7 <tt class="method">strftime()</tt> Behavior</a> | |
144 | </ul> | |
145 | <!--End of Table of Child-Links--> | |
146 | </div> | |
147 | ||
148 | <DIV CLASS="navigation"> | |
149 | <div class='online-navigation'> | |
150 | <p></p><hr /> | |
151 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
152 | <tr> | |
153 | <td class='online-navigation'><a rel="prev" title="6.9.2 Flow Control Issues" | |
154 | href="popen2-flow-control.html"><img src='../icons/previous.png' | |
155 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
156 | <td class='online-navigation'><a rel="parent" title="6. Generic Operating System" | |
157 | href="allos.html"><img src='../icons/up.png' | |
158 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
159 | <td class='online-navigation'><a rel="next" title="6.10.1 Available Types" | |
160 | href="node251.html"><img src='../icons/next.png' | |
161 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
162 | <td align="center" width="100%">Python Library Reference</td> | |
163 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
164 | href="contents.html"><img src='../icons/contents.png' | |
165 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
166 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
167 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
168 | <td class='online-navigation'><a rel="index" title="Index" | |
169 | href="genindex.html"><img src='../icons/index.png' | |
170 | border='0' height='32' alt='Index' width='32' /></A></td> | |
171 | </tr></table> | |
172 | <div class='online-navigation'> | |
173 | <b class="navlabel">Previous:</b> | |
174 | <a class="sectref" rel="prev" href="popen2-flow-control.html">6.9.2 Flow Control Issues</A> | |
175 | <b class="navlabel">Up:</b> | |
176 | <a class="sectref" rel="parent" href="allos.html">6. Generic Operating System</A> | |
177 | <b class="navlabel">Next:</b> | |
178 | <a class="sectref" rel="next" href="node251.html">6.10.1 Available Types</A> | |
179 | </div> | |
180 | </div> | |
181 | <hr /> | |
182 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
183 | </DIV> | |
184 | <!--End of Navigation Panel--> | |
185 | <ADDRESS> | |
186 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
187 | </ADDRESS> | |
188 | </BODY> | |
189 | </HTML> |