File: qdate.html

package info (click to toggle)
python-qt4 4.0.1-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 18,632 kB
  • ctags: 2,639
  • sloc: python: 29,409; sh: 5,646; cpp: 3,168; xml: 149; makefile: 109
file content (329 lines) | stat: -rw-r--r-- 31,007 bytes parent folder | download
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
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QDate Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDate Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QDate class provides date functions. <a href="#details">More...</a></p>
<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdate.html#QDate">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdate.html#QDate-2">__init__</a></b> (<i>self</i>, int&#160;<i>y</i>, int&#160;<i>m</i>, int&#160;<i>d</i>)</li><li><div class="fn" /><b><a href="qdate.html#QDate-3">__init__</a></b> (<i>self</i>, QDate)</li><li><div class="fn" />QDate <b><a href="qdate.html#addDays">addDays</a></b> (<i>self</i>, int&#160;<i>days</i>)</li><li><div class="fn" />QDate <b><a href="qdate.html#addMonths">addMonths</a></b> (<i>self</i>, int&#160;<i>months</i>)</li><li><div class="fn" />QDate <b><a href="qdate.html#addYears">addYears</a></b> (<i>self</i>, int&#160;<i>years</i>)</li><li><div class="fn" />int <b><a href="qdate.html#day">day</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qdate.html#dayOfWeek">dayOfWeek</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qdate.html#dayOfYear">dayOfYear</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qdate.html#daysInMonth">daysInMonth</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qdate.html#daysInYear">daysInYear</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qdate.html#daysTo">daysTo</a></b> (<i>self</i>, QDate)</li><li><div class="fn" />bool <b><a href="qdate.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdate.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qdate.html#month">month</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdate.html#setYMD">setYMD</a></b> (<i>self</i>, int&#160;<i>y</i>, int&#160;<i>m</i>, int&#160;<i>d</i>)</li><li><div class="fn" />int <b><a href="qdate.html#toJulianDay">toJulianDay</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdate.html#toString">toString</a></b> (<i>self</i>, Qt.DateFormat&#160;<i>f</i>&#160;=&#160;Qt.TextDate)</li><li><div class="fn" />QString <b><a href="qdate.html#toString-2">toString</a></b> (<i>self</i>, QString&#160;<i>format</i>)</li><li><div class="fn" />(int, int&#160;<i>yearNum</i>) <b><a href="qdate.html#weekNumber">weekNumber</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qdate.html#year">year</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QDate <b><a href="qdate.html#currentDate">currentDate</a></b> ()</li><li><div class="fn" />QDate <b><a href="qdate.html#fromJulianDay">fromJulianDay</a></b> (int&#160;<i>jd</i>)</li><li><div class="fn" />QDate <b><a href="qdate.html#fromString">fromString</a></b> (QString&#160;<i>s</i>, Qt.DateFormat&#160;<i>f</i>&#160;=&#160;Qt.TextDate)</li><li><div class="fn" />QDate <b><a href="qdate.html#fromString-2">fromString</a></b> (QString&#160;<i>s</i>, QString&#160;<i>format</i>)</li><li><div class="fn" />unsigned long <b><a href="qdate.html#gregorianToJulian">gregorianToJulian</a></b> (int&#160;<i>y</i>, int&#160;<i>m</i>, int&#160;<i>d</i>)</li><li><div class="fn" />bool <b><a href="qdate.html#isLeapYear">isLeapYear</a></b> (int&#160;<i>year</i>)</li><li><div class="fn" />bool <b><a href="qdate.html#isValid-2">isValid</a></b> (int&#160;<i>y</i>, int&#160;<i>m</i>, int&#160;<i>d</i>)</li><li><div class="fn" />(int&#160;<i>y</i>, int&#160;<i>m</i>, int&#160;<i>d</i>) <b><a href="qdate.html#julianToGregorian">julianToGregorian</a></b> (unsigned long&#160;<i>jd</i>)</li><li><div class="fn" />QString <b><a href="qdate.html#longDayName">longDayName</a></b> (int&#160;<i>weekday</i>)</li><li><div class="fn" />QString <b><a href="qdate.html#longMonthName">longMonthName</a></b> (int&#160;<i>month</i>)</li><li><div class="fn" />QString <b><a href="qdate.html#shortDayName">shortDayName</a></b> (int&#160;<i>weekday</i>)</li><li><div class="fn" />QString <b><a href="qdate.html#shortMonthName">shortMonthName</a></b> (int&#160;<i>month</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qdate.html#__eq__">__eq__</a></b> (<i>self</i>, QDate&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qdate.html#__ge__">__ge__</a></b> (<i>self</i>, QDate&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qdate.html#__gt__">__gt__</a></b> (<i>self</i>, QDate&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qdate.html#__le__">__le__</a></b> (<i>self</i>, QDate&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qdate.html#__lt__">__lt__</a></b> (<i>self</i>, QDate&#160;<i>other</i>)</li><li><div class="fn" />bool <b><a href="qdate.html#__ne__">__ne__</a></b> (<i>self</i>, QDate&#160;<i>other</i>)</li><li><div class="fn" />int <b><a href="qdate.html#__nonzero__">__nonzero__</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDate class provides date functions.</p>
<p>A QDate object contains a calendar date, i.e. year, month, and day numbers, in the modern Western (Gregorian) calendar. It can read the current date from the system clock. It provides functions for comparing dates, and for manipulating dates. For example, it is possible to add and subtract days, months, and years to dates.</p>
<p>A QDate object is typically created either by giving the year, month, and day numbers explicitly, or by using the static function <a href="qdate-qt3.html#currentDate">currentDate</a>() that creates a QDate object containing the system clock's date. An explicit date can also be set using <a href="qdate.html#setYMD">setYMD</a>(). The <a href="qdate.html#fromString">fromString</a>() function returns a QDate given a string and a date format which is used to interpret the date within the string.</p>
<p>The <a href="qdate.html#year">year</a>(), <a href="qdate.html#month">month</a>(), and <a href="qdate.html#day">day</a>() functions provide access to the year, month, and day numbers. Also, <a href="qdate.html#dayOfWeek">dayOfWeek</a>() and <a href="qdate.html#dayOfYear">dayOfYear</a>() functions are provided. The same information is provided in textual format by the <a href="qdate.html#toString">toString</a>(), <a href="qdate.html#shortDayName">shortDayName</a>(), <a href="qdate.html#longDayName">longDayName</a>(), <a href="qdate.html#shortMonthName">shortMonthName</a>(), and <a href="qdate.html#longMonthName">longMonthName</a>() functions.</p>
<p>QDate provides a full set of operators to compare two QDate objects where smaller means earlier, and larger means later.</p>
<p>You can increment (or decrement) a date by a given number of days using <a href="qdate.html#addDays">addDays</a>(). Similarly you can use <a href="qdate.html#addMonths">addMonths</a>() and <a href="qdate.html#addYears">addYears</a>(). The <a href="qdate.html#daysTo">daysTo</a>() function returns the number of days between two dates.</p>
<p>The <a href="qdate.html#daysInMonth">daysInMonth</a>() and <a href="qdate.html#daysInYear">daysInYear</a>() functions return how many days there are in this date's month and year, respectively. The <a href="qdate.html#isLeapYear">isLeapYear</a>() function indicates whether this date is in a leap year.</p>
<p>Note that QDate should not be used for date calculations for dates prior to the introduction of the Gregorian calendar. This calendar was adopted by England from the 14 September 1752 (hence this is the earliest valid QDate), and subsequently by most other Western countries, by 1923. The latest valid date within this scheme is 31 December 7999.</p>
<p>See also <a href="qtime.html">QTime</a>, <a href="qdatetime.html">QDateTime</a>, <a href="qdateedit.html">QDateEdit</a>, and <a href="qdatetimeedit.html">QDateTimeEdit</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDate" />QDate.__init__ (<i>self</i>)</h3><p>Constructs a null date. Null dates are invalid.</p>
<p>See also <a href="qdate.html#isNull">isNull</a>() and <a href="qdate.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QDate-2" />QDate.__init__ (<i>self</i>, int&#160;<i>y</i>, int&#160;<i>m</i>, int&#160;<i>d</i>)</h3><p>Constructs a date with year <i>y</i>, month <i>m</i> and day <i>d</i>.</p>
<p><i>y</i> must be in the range 1752 to 8000, <i>m</i> must be in the range 1 to 12, and <i>d</i> must be in the range 1 to 31.</p>
<p><b>Warning:</b> If <i>y</i> is in the range 0 to 99, it is interpreted as a year in the range 1900 to 1999.</p>
<p>See also <a href="qdate.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="QDate-3" />QDate.__init__ (<i>self</i>, <a href="qdate.html">QDate</a>)</h3><h3 class="fn"><a name="addDays" /><a href="qdate.html">QDate</a> QDate.addDays (<i>self</i>, int&#160;<i>days</i>)</h3><p>Returns a <a href="qdate.html">QDate</a> object containing a date <i>ndays</i> later than the date of this object (or earlier if <i>ndays</i> is negative).</p>
<p>See also <a href="qdate.html#addMonths">addMonths</a>(), <a href="qdate.html#addYears">addYears</a>(), and <a href="qdate.html#daysTo">daysTo</a>().</p>
<h3 class="fn"><a name="addMonths" /><a href="qdate.html">QDate</a> QDate.addMonths (<i>self</i>, int&#160;<i>months</i>)</h3><p>Returns a <a href="qdate.html">QDate</a> object containing a date <i>nmonths</i> later than the date of this object (or earlier if <i>nmonths</i> is negative).</p>
<p>See also <a href="qdate.html#addDays">addDays</a>() and <a href="qdate.html#addYears">addYears</a>().</p>
<h3 class="fn"><a name="addYears" /><a href="qdate.html">QDate</a> QDate.addYears (<i>self</i>, int&#160;<i>years</i>)</h3><p>Returns a <a href="qdate.html">QDate</a> object containing a date <i>nyears</i> later than the date of this object (or earlier if <i>nyears</i> is negative).</p>
<p>See also <a href="qdate.html#addDays">addDays</a>() and <a href="qdate.html#addMonths">addMonths</a>().</p>
<h3 class="fn"><a name="currentDate" /><a href="qdate.html">QDate</a> QDate.currentDate ()</h3><h3 class="fn"><a name="day" />int QDate.day (<i>self</i>)</h3><p>Returns the day of the month (1 to 31) of this date.</p>
<p>See also <a href="qdate.html#year">year</a>(), <a href="qdate.html#month">month</a>(), and <a href="qdate.html#dayOfWeek">dayOfWeek</a>().</p>
<h3 class="fn"><a name="dayOfWeek" />int QDate.dayOfWeek (<i>self</i>)</h3><p>Returns the weekday (1 to 7) for this date.</p>
<p>See also <a href="qdate.html#day">day</a>(), <a href="qdate.html#dayOfYear">dayOfYear</a>(), and <a href="qt.html#DayOfWeek-enum">Qt.DayOfWeek</a>.</p>
<h3 class="fn"><a name="dayOfYear" />int QDate.dayOfYear (<i>self</i>)</h3><p>Returns the day of the year (1 to 365) for this date.</p>
<p>See also <a href="qdate.html#day">day</a>() and <a href="qdate.html#dayOfWeek">dayOfWeek</a>().</p>
<h3 class="fn"><a name="daysInMonth" />int QDate.daysInMonth (<i>self</i>)</h3><p>Returns the number of days in the month (28 to 31) for this date.</p>
<p>See also <a href="qdate.html#day">day</a>() and <a href="qdate.html#daysInYear">daysInYear</a>().</p>
<h3 class="fn"><a name="daysInYear" />int QDate.daysInYear (<i>self</i>)</h3><p>Returns the number of days in the year (365 or 366) for this date.</p>
<p>See also <a href="qdate.html#day">day</a>() and <a href="qdate.html#daysInMonth">daysInMonth</a>().</p>
<h3 class="fn"><a name="daysTo" />int QDate.daysTo (<i>self</i>, <a href="qdate.html">QDate</a>)</h3><p>Returns the number of days from this date to <i>d</i> (which is negative if <i>d</i> is earlier than this date).</p>
<p>Example:</p>
<pre>
    QDate d1(1995, 5, 17);  // May 17, 1995
    QDate d2(1995, 5, 20);  // May 20, 1995
    d1.daysTo(d2);          // returns 3
    d2.daysTo(d1);          // returns -3
</pre>
<p>See also <a href="qdate.html#addDays">addDays</a>().</p>
<h3 class="fn"><a name="fromJulianDay" /><a href="qdate.html">QDate</a> QDate.fromJulianDay (int&#160;<i>jd</i>)</h3><p>Converts the Julian day <i>jd</i> to a <a href="qdate.html">QDate</a>.</p>
<p>See also <a href="qdate.html#toJulianDay">toJulianDay</a>().</p>
<h3 class="fn"><a name="fromString" /><a href="qdate.html">QDate</a> QDate.fromString (<a href="qstring.html">QString</a>&#160;<i>s</i>, <a href="qt.html#DateFormat-enum">Qt.DateFormat</a>&#160;<i>f</i>&#160;=&#160;Qt.TextDate)</h3><p>Returns the <a href="qdate.html">QDate</a> represented by the <i>string</i>, using the <i>format</i> given, or an invalid date if the string cannot be parsed.</p>
<p>Note for <a href="qt.html#DateFormat-enum">Qt.TextDate</a>: It is recommended that you use the English short month names (e.g. "Jan"). Although localized month names can also be used, they depend on the user's locale settings.</p>
<p><b>Warning:</b> <a href="qt.html#DateFormat-enum">Qt.LocalDate</a> cannot be used here.</p>
<h3 class="fn"><a name="fromString-2" /><a href="qdate.html">QDate</a> QDate.fromString (<a href="qstring.html">QString</a>&#160;<i>s</i>, <a href="qstring.html">QString</a>&#160;<i>format</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Returns the <a href="qdate.html">QDate</a> represented by the <i>string</i>, using the <i>format</i> given, or an invalid date if the string cannot be parsed.</p>
<p>These expressions may be used for the format:</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#A2C511" valign="top">
<th>Expression</th>
<th>Output</th>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>d</td>
<td>The day as a number without a leading zero (1 to 31)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>dd</td>
<td>The day as a number with a leading zero (01 to 31)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>ddd</td>
<td>The abbreviated localized day name (e.g. 'Mon' to 'Sun'). Uses <a href="qdate.html#shortDayName">QDate.shortDayName</a>().</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>dddd</td>
<td>The long localized day name (e.g. 'Monday' to 'Sunday'). Uses <a href="qdate.html#longDayName">QDate.longDayName</a>().</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>M</td>
<td>The month as a number without a leading zero (1 to 12)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>MM</td>
<td>The month as a number with a leading zero (01 to 12)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>MMM</td>
<td>The abbreviated localized month name (e.g. 'Jan' to 'Dec'). Uses <a href="qdate.html#shortMonthName">QDate.shortMonthName</a>().</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>MMMM</td>
<td>The long localized month name (e.g. 'January' to 'December'). Uses <a href="qdate.html#longMonthName">QDate.longMonthName</a>().</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>yy</td>
<td>The year as two digit number (00 to 99)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>yyyy</td>
<td>The year as four digit number (1752 to 8000)</td>
</tr>
</table>
<br />
<br />
<p>All other input characters will be treated as text. Any sequence of characters that are enclosed in single quotes will also be treated as text and will not be used as an expression. For example:</p>
<pre>
    QDate date = QDate.fromString("1MM12car2003", "d'MM'MMcaryyyy");
    // date is 1 December 2003
</pre>
<p>If the format is not satisfied, an invalid <a href="qdate.html">QDate</a> is returned. The expressions that don't expect leading zeroes (d, M) will be greedy. This means that they will use two digits even if this will put them outside the accepted range of values and leaves too few digits for other sections. For example, the following format string could have meant January 30 but the M will grab two digits, resulting in an invalid date:</p>
<pre>
    QDate date = QDate.fromString("130", "Md"); // invalid
</pre>
<p>For any field that is not represented in the format the following defaults are used:</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#A2C511" valign="top">
<th>Field</th>
<th>Default value</th>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Year</td>
<td>1900</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>Month</td>
<td>1</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>Day</td>
<td>1</td>
</tr>
</table>
<br />
<br />
<p>The following examples demonstrate the default values:</p>
<pre>
    QDate.fromString("1.30", "M.d");           // January 30 1900
    QDate.fromString("20000110", "yyyyMMdd");  // January 10, 2000
    QDate.fromString("20000110", "yyyyMd");    // January 10, 2000
</pre>
<p>See also <a href="qdatetime.html#fromString">QDateTime.fromString</a>(), <a href="qtime.html#fromString">QTime.fromString</a>(), <a href="qdate.html#toString">QDate.toString</a>(), <a href="qdatetime.html#toString">QDateTime.toString</a>(), and <a href="qtime.html#toString">QTime.toString</a>().</p>
<h3 class="fn"><a name="gregorianToJulian" />unsigned long QDate.gregorianToJulian (int&#160;<i>y</i>, int&#160;<i>m</i>, int&#160;<i>d</i>)</h3><h3 class="fn"><a name="isLeapYear" />bool QDate.isLeapYear (int&#160;<i>year</i>)</h3><p>Returns true if the specified <i>year</i> is a leap year; otherwise returns false.</p>
<h3 class="fn"><a name="isNull" />bool QDate.isNull (<i>self</i>)</h3><p>Returns true if the date is null; otherwise returns false. A null date is invalid.</p>
<p>See also <a href="qdate.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="isValid" />bool QDate.isValid (<i>self</i>)</h3><p>Returns true if this date is valid; otherwise returns false.</p>
<p>See also <a href="qdate.html#isNull">isNull</a>().</p>
<h3 class="fn"><a name="isValid-2" />bool QDate.isValid (int&#160;<i>y</i>, int&#160;<i>m</i>, int&#160;<i>d</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Returns true if the specified date (year <i>y</i>, month <i>m</i>, and day <i>d</i>) is valid; otherwise returns false.</p>
<p>Example:</p>
<pre>
    QDate.isValid(2002, 5, 17);  // true
    QDate.isValid(2002, 2, 30);  // false (Feb 30 does not exist)
    QDate.isValid(2004, 2, 29);  // true (2004 is a leap year)
    QDate.isValid(1202, 6, 6);   // false (1202 is pre-Gregorian)
</pre>
<p><b>Warning:</b> A <i>y</i> value in the range 00 to 99 is interpreted as 1900 to 1999.</p>
<p>See also <a href="qdate.html#isNull">isNull</a>() and <a href="qdate.html#setYMD">setYMD</a>().</p>
<h3 class="fn"><a name="julianToGregorian" />(int&#160;<i>y</i>, int&#160;<i>m</i>, int&#160;<i>d</i>) QDate.julianToGregorian (unsigned long&#160;<i>jd</i>)</h3><h3 class="fn"><a name="longDayName" /><a href="qstring.html">QString</a> QDate.longDayName (int&#160;<i>weekday</i>)</h3><p>Returns the long name of the <i>weekday</i> using the following convention:</p>
<ul>
<li>1 = "Monday"</li>
<li>2 = "Tuesday"</li>
<li>3 = "Wednesday"</li>
<li>4 = "Thursday"</li>
<li>5 = "Friday"</li>
<li>6 = "Saturday"</li>
<li>7 = "Sunday"</li>
</ul>
<p>The day names will be localized according to the system's locale settings.</p>
<p>See also <a href="qdate.html#toString">toString</a>(), <a href="qdate.html#shortDayName">shortDayName</a>(), <a href="qdate.html#shortMonthName">shortMonthName</a>(), and <a href="qdate.html#longMonthName">longMonthName</a>().</p>
<h3 class="fn"><a name="longMonthName" /><a href="qstring.html">QString</a> QDate.longMonthName (int&#160;<i>month</i>)</h3><p>Returns the long name of the <i>month</i> using the following convention:</p>
<ul>
<li>1 = "January"</li>
<li>2 = "February"</li>
<li>3 = "March"</li>
<li>4 = "April"</li>
<li>5 = "May"</li>
<li>6 = "June"</li>
<li>7 = "July"</li>
<li>8 = "August"</li>
<li>9 = "September"</li>
<li>10 = "October"</li>
<li>11 = "November"</li>
<li>12 = "December"</li>
</ul>
<p>The month names will be localized according to the system's locale settings.</p>
<p>See also <a href="qdate.html#toString">toString</a>(), <a href="qdate.html#shortMonthName">shortMonthName</a>(), <a href="qdate.html#shortDayName">shortDayName</a>(), and <a href="qdate.html#longDayName">longDayName</a>().</p>
<h3 class="fn"><a name="month" />int QDate.month (<i>self</i>)</h3><p>Returns the number corresponding to the month of this date, using the following convention:</p>
<ul>
<li>1 = "January"</li>
<li>2 = "February"</li>
<li>3 = "March"</li>
<li>4 = "April"</li>
<li>5 = "May"</li>
<li>6 = "June"</li>
<li>7 = "July"</li>
<li>8 = "August"</li>
<li>9 = "September"</li>
<li>10 = "October"</li>
<li>11 = "November"</li>
<li>12 = "December"</li>
</ul>
<p>See also <a href="qdate.html#year">year</a>() and <a href="qdate.html#day">day</a>().</p>
<h3 class="fn"><a name="setYMD" />bool QDate.setYMD (<i>self</i>, int&#160;<i>y</i>, int&#160;<i>m</i>, int&#160;<i>d</i>)</h3><p>Sets the date's year <i>y</i>, month <i>m</i>, and day <i>d</i>.</p>
<p><i>y</i> must be in the range 1752 to 8000, <i>m</i> must be in the range 1 to 12, and <i>d</i> must be in the range 1 to 31.</p>
<p><b>Warning:</b> If <i>y</i> is in the range 0 to 99, it is interpreted as 1900 to 1999.</p>
<p>Returns true if the date is valid; otherwise returns false.</p>
<h3 class="fn"><a name="shortDayName" /><a href="qstring.html">QString</a> QDate.shortDayName (int&#160;<i>weekday</i>)</h3><p>Returns the name of the <i>weekday</i> using the following convention:</p>
<ul>
<li>1 = "Mon"</li>
<li>2 = "Tue"</li>
<li>3 = "Wed"</li>
<li>4 = "Thu"</li>
<li>5 = "Fri"</li>
<li>6 = "Sat"</li>
<li>7 = "Sun"</li>
</ul>
<p>The day names will be localized according to the system's locale settings.</p>
<p>See also <a href="qdate.html#toString">toString</a>(), <a href="qdate.html#shortMonthName">shortMonthName</a>(), <a href="qdate.html#longMonthName">longMonthName</a>(), and <a href="qdate.html#longDayName">longDayName</a>().</p>
<h3 class="fn"><a name="shortMonthName" /><a href="qstring.html">QString</a> QDate.shortMonthName (int&#160;<i>month</i>)</h3><p>Returns the name of the <i>month</i> using the following convention:</p>
<ul>
<li>1 = "Jan"</li>
<li>2 = "Feb"</li>
<li>3 = "Mar"</li>
<li>4 = "Apr"</li>
<li>5 = "May"</li>
<li>6 = "Jun"</li>
<li>7 = "Jul"</li>
<li>8 = "Aug"</li>
<li>9 = "Sep"</li>
<li>10 = "Oct"</li>
<li>11 = "Nov"</li>
<li>12 = "Dec"</li>
</ul>
<p>The month names will be localized according to the system's locale settings.</p>
<p>See also <a href="qdate.html#toString">toString</a>(), <a href="qdate.html#longMonthName">longMonthName</a>(), <a href="qdate.html#shortDayName">shortDayName</a>(), and <a href="qdate.html#longDayName">longDayName</a>().</p>
<h3 class="fn"><a name="toJulianDay" />int QDate.toJulianDay (<i>self</i>)</h3><p>Converts the date to a Julian day.</p>
<p>See also <a href="qdate.html#fromJulianDay">fromJulianDay</a>().</p>
<h3 class="fn"><a name="toString" /><a href="qstring.html">QString</a> QDate.toString (<i>self</i>, <a href="qt.html#DateFormat-enum">Qt.DateFormat</a>&#160;<i>f</i>&#160;=&#160;Qt.TextDate)</h3><p>Returns the date as a string. The <i>format</i> parameter determines the format of the result string.</p>
<p>These expressions may be used:</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#A2C511" valign="top">
<th>Expression</th>
<th>Output</th>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>d</td>
<td>the day as number without a leading zero (1 to31)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>dd</td>
<td>the day as number with a leading zero (01 to 31)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>ddd</td>
<td>the abbreviated localized day name (e.g. 'Mon' to 'Sun'). Uses <a href="qdate.html#shortDayName">QDate.shortDayName</a>().</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>dddd</td>
<td>the long localized day name (e.g. '<a href="qt.html#DayOfWeek-enum">Qt.Monday</a>' to '<a href="qt.html#DayOfWeek-enum">Qt.Sunday</a>'). Uses <a href="qdate.html#longDayName">QDate.longDayName</a>().</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>M</td>
<td>the month as number without a leading zero (1-12)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>MM</td>
<td>the month as number with a leading zero (01-12)</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>MMM</td>
<td>the abbreviated localized month name (e.g. 'Jan' to 'Dec'). Uses <a href="qdate.html#shortMonthName">QDate.shortMonthName</a>().</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>MMMM</td>
<td>the long localized month name (e.g. 'January' to 'December'). Uses <a href="qdate.html#longMonthName">QDate.longMonthName</a>().</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>yy</td>
<td>the year as two digit number (00 to 99)</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>yyyy</td>
<td>the year as four digit number (1752 to 8000)</td>
</tr>
</table>
<br />
<br />
<p>All other input characters will be ignored. Any sequence of characters that are enclosed in singlequotes will be treated as text and not be used as an expression.</p>
<p>Example format strings (assuming that the <a href="qdate.html">QDate</a> is the 20 July 1969):</p>
<table align="center" border="0" cellpadding="2" cellspacing="1">
<tr bgcolor="#A2C511" valign="top">
<th>Format</th>
<th>Result</th>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>dd.MM.yyyy</td>
<td>20.07.1969</td>
</tr>
<tr bgcolor="#E0E0E0" valign="top">
<td>ddd MMMM d yy</td>
<td>Sun July 20 69</td>
</tr>
<tr bgcolor="#F0F0F0" valign="top">
<td>'The day is' dddd</td>
<td>The day is Sunday</td>
</tr>
</table>
<br />
<br />
<p>If the datetime is invalid, an empty string will be returned.</p>
<p>See also <a href="qdatetime.html#toString">QDateTime.toString</a>() and <a href="qtime.html#toString">QTime.toString</a>().</p>
<h3 class="fn"><a name="toString-2" /><a href="qstring.html">QString</a> QDate.toString (<i>self</i>, <a href="qstring.html">QString</a>&#160;<i>format</i>)</h3><p>This is an overloaded member function, provided for convenience.</p>
<p>Returns the date as a string. The <i>format</i> parameter determines the format of the string.</p>
<p>If the <i>format</i> is <a href="qt.html#DateFormat-enum">Qt.TextDate</a>, the string is formatted in the default way. <a href="qdate.html#shortDayName">QDate.shortDayName</a>() and <a href="qdate.html#shortMonthName">QDate.shortMonthName</a>() are used to generate the string, so the day and month names will be localized names. An example of this formatting is "Sat May 20 1995".</p>
<p>If the <i>format</i> is <a href="qt.html#DateFormat-enum">Qt.ISODate</a>, the string format corresponds to the ISO 8601 extended specification for representations of dates and times, taking the form YYYY-MM-DD, where YYYY is the year, MM is the month of the year (between 01 and 12), and DD is the day of the month between 01 and 31.</p>
<p>If the <i>format</i> is <a href="qt.html#DateFormat-enum">Qt.LocalDate</a>, the string format depends on the locale settings of the system. On Mac OS X, an assumption is made that the date is in the local time zone.</p>
<p>If the datetime is invalid, an empty string will be returned.</p>
<p>See also <a href="qdate.html#shortDayName">shortDayName</a>() and <a href="qdate.html#shortMonthName">shortMonthName</a>().</p>
<h3 class="fn"><a name="weekNumber" />(int, int&#160;<i>yearNum</i>) QDate.weekNumber (<i>self</i>)</h3><p>Returns the week number (1 to 53), and stores the year in *<i>yearNumber</i> unless <i>yearNumber</i> is null (the default).</p>
<p>Returns 0 if the date is invalid.</p>
<p>In accordance with ISO 8601, weeks start on <a href="qt.html#DayOfWeek-enum">Qt.Monday</a> and the first <a href="qt.html#DayOfWeek-enum">Qt.Thursday</a> of a year is always in week 1 of that year. Most years have 52 weeks, but some have 53.</p>
<p>*<i>yearNumber</i> is not always the same as <a href="qdate.html#year">year</a>(). For example, 1 January 2000 has week number 52 in the year 1999, and 31 December 2002 has week number 1 in the year 2003.</p>
<p>Copyright (c) 1989 The Regents of the University of California. All rights reserved.</p>
<p>Redistribution and use in source and binary forms are permitted provided that the above copyright notice and this paragraph are duplicated in all such forms and that any documentation, advertising materials, and other materials related to such distribution and use acknowledge that the software was developed by the University of California, Berkeley. The name of the University may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</p>
<p>See also <a href="qdate.html#isValid">isValid</a>().</p>
<h3 class="fn"><a name="year" />int QDate.year (<i>self</i>)</h3><p>Returns the year (1752 to 8000) of this date.</p>
<p>See also <a href="qdate.html#month">month</a>() and <a href="qdate.html#day">day</a>().</p>
<h3 class="fn"><a name="__eq__" />bool QDate.__eq__ (<i>self</i>, <a href="qdate.html">QDate</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__ge__" />bool QDate.__ge__ (<i>self</i>, <a href="qdate.html">QDate</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__gt__" />bool QDate.__gt__ (<i>self</i>, <a href="qdate.html">QDate</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__le__" />bool QDate.__le__ (<i>self</i>, <a href="qdate.html">QDate</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__lt__" />bool QDate.__lt__ (<i>self</i>, <a href="qdate.html">QDate</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__ne__" />bool QDate.__ne__ (<i>self</i>, <a href="qdate.html">QDate</a>&#160;<i>other</i>)</h3><h3 class="fn"><a name="__nonzero__" />int QDate.__nonzero__ (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td width="25%">PyQt&#160;4.0.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.trolltech.com">Trolltech&#160;AS</a> 2006</td><td align="right" width="25%">Qt&#160;4.1.4</td></tr></table></div></address></body></html>