summaryrefslogtreecommitdiffstats
path: root/doc/html/tqdate.html
blob: 8da5b99816d26bd8ba9f412869cea8c17538bdf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQDate Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQDate Class Reference</h1>

<p>The TQDate class provides date functions.
<a href="#details">More...</a>
<p>All the functions in this class are <a href="threads.html#reentrant">reentrant</a> when TQt is built with thread support.</p>
<p><tt>#include &lt;<a href="tqdatetime-h.html">tqdatetime.h</a>&gt;</tt>
<p><a href="tqdate-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQDate"><b>TQDate</b></a> ()</li>
<li class=fn><a href="#TQDate-2"><b>TQDate</b></a> ( int&nbsp;y, int&nbsp;m, int&nbsp;d )</li>
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
<li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
<li class=fn>int <a href="#year"><b>year</b></a> () const</li>
<li class=fn>int <a href="#month"><b>month</b></a> () const</li>
<li class=fn>int <a href="#day"><b>day</b></a> () const</li>
<li class=fn>int <a href="#dayOfWeek"><b>dayOfWeek</b></a> () const</li>
<li class=fn>int <a href="#dayOfYear"><b>dayOfYear</b></a> () const</li>
<li class=fn>int <a href="#daysInMonth"><b>daysInMonth</b></a> () const</li>
<li class=fn>int <a href="#daysInYear"><b>daysInYear</b></a> () const</li>
<li class=fn>int <a href="#weekNumber"><b>weekNumber</b></a> ( int&nbsp;*&nbsp;yearNumber = 0 ) const</li>
<li class=fn>TQString <a href="#toString-2"><b>toString</b></a> ( TQt::DateFormat&nbsp;f = TQt::TextDate ) const</li>
<li class=fn>TQString <a href="#toString"><b>toString</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;format ) const</li>
<li class=fn>bool <a href="#setYMD"><b>setYMD</b></a> ( int&nbsp;y, int&nbsp;m, int&nbsp;d )</li>
<li class=fn>TQDate <a href="#addDays"><b>addDays</b></a> ( int&nbsp;ndays ) const</li>
<li class=fn>TQDate <a href="#addMonths"><b>addMonths</b></a> ( int&nbsp;nmonths ) const</li>
<li class=fn>TQDate <a href="#addYears"><b>addYears</b></a> ( int&nbsp;nyears ) const</li>
<li class=fn>int <a href="#daysTo"><b>daysTo</b></a> ( const&nbsp;TQDate&nbsp;&amp;&nbsp;d ) const</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;TQDate&nbsp;&amp;&nbsp;d ) const</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;TQDate&nbsp;&amp;&nbsp;d ) const</li>
<li class=fn>bool <a href="#operator-lt"><b>operator&lt;</b></a> ( const&nbsp;TQDate&nbsp;&amp;&nbsp;d ) const</li>
<li class=fn>bool <a href="#operator-lt-eq"><b>operator&lt;=</b></a> ( const&nbsp;TQDate&nbsp;&amp;&nbsp;d ) const</li>
<li class=fn>bool <a href="#operator-gt"><b>operator&gt;</b></a> ( const&nbsp;TQDate&nbsp;&amp;&nbsp;d ) const</li>
<li class=fn>bool <a href="#operator-gt-eq"><b>operator&gt;=</b></a> ( const&nbsp;TQDate&nbsp;&amp;&nbsp;d ) const</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>TQString monthName ( int&nbsp;month ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>TQString dayName ( int&nbsp;weekday ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>TQString <a href="#shortMonthName"><b>shortMonthName</b></a> ( int&nbsp;month )</li>
<li class=fn>TQString <a href="#shortDayName"><b>shortDayName</b></a> ( int&nbsp;weekday )</li>
<li class=fn>TQString <a href="#longMonthName"><b>longMonthName</b></a> ( int&nbsp;month )</li>
<li class=fn>TQString <a href="#longDayName"><b>longDayName</b></a> ( int&nbsp;weekday )</li>
<li class=fn>TQDate <a href="#currentDate-2"><b>currentDate</b></a> ()</li>
<li class=fn>TQDate <a href="#currentDate"><b>currentDate</b></a> ( TQt::TimeSpec&nbsp;ts )</li>
<li class=fn>TQDate <a href="#fromString"><b>fromString</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;s, TQt::DateFormat&nbsp;f = TQt::TextDate )</li>
<li class=fn>bool <a href="#isValid-2"><b>isValid</b></a> ( int&nbsp;y, int&nbsp;m, int&nbsp;d )</li>
<li class=fn>bool <a href="#leapYear"><b>leapYear</b></a> ( int&nbsp;y )</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>TQDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( TQDataStream&nbsp;&amp;&nbsp;s, const&nbsp;TQDate&nbsp;&amp;&nbsp;d )</li>
<li class=fn>TQDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( TQDataStream&nbsp;&amp;&nbsp;s, TQDate&nbsp;&amp;&nbsp;d )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>



The TQDate class provides date functions.
<p> 

<p> A TQDate 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, e.g. by adding a
number of days or months or years.
<p> A TQDate object is typically created either by giving the year,
month and day numbers explicitly, or by using the static function
<a href="#currentDate">currentDate</a>(), which creates a TQDate object containing the system
clock's date. An explicit date can also be set using <a href="#setYMD">setYMD</a>(). The
<a href="#fromString">fromString</a>() function returns a TQDate given a string and a date
format which is used to interpret the date within the string.
<p> The <a href="#year">year</a>(), <a href="#month">month</a>(), and <a href="#day">day</a>() functions provide access to the
year, month, and day numbers. Also, <a href="#dayOfWeek">dayOfWeek</a>() and <a href="#dayOfYear">dayOfYear</a>()
functions are provided. The same information is provided in
textual format by the <a href="#toString">toString</a>(), <a href="#shortDayName">shortDayName</a>(), <a href="#longDayName">longDayName</a>(),
<a href="#shortMonthName">shortMonthName</a>() and <a href="#longMonthName">longMonthName</a>() functions.
<p> TQDate provides a full set of operators to compare two TQDate
objects where smaller means earlier and larger means later.
<p> You can increment (or decrement) a date by a given number of days
using <a href="#addDays">addDays</a>(). Similarly you can use <a href="#addMonths">addMonths</a>() and <a href="#addYears">addYears</a>().
The <a href="#daysTo">daysTo</a>() function returns the number of days between two
dates.
<p> The <a href="#daysInMonth">daysInMonth</a>() and <a href="#daysInYear">daysInYear</a>() functions return how many days
there are in this date's month and year, respectively. The
<a href="#leapYear">leapYear</a>() function indicates whether this date is in a leap year.
<p> Note that TQDate 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<sup><small>th</small></sup>
September 1752 (hence this is the earliest valid TQDate), and
subsequently by most other Western countries, until 1923.
<p> The end of time is reached around the year 8000, by which time we
expect TQt to be obsolete.
<p> <p>See also <a href="tqtime.html">TQTime</a>, <a href="tqdatetime.html">TQDateTime</a>, <a href="tqdateedit.html">TQDateEdit</a>, <a href="tqdatetimeedit.html">TQDateTimeEdit</a>, and <a href="time.html">Time and Date</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQDate"></a>TQDate::TQDate ()
</h3>

<p> Constructs a null date. Null dates are invalid.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#isValid">isValid</a>().

<h3 class=fn><a name="TQDate-2"></a>TQDate::TQDate ( int&nbsp;y, int&nbsp;m, int&nbsp;d )
</h3>
Constructs a date with year <em>y</em>, month <em>m</em> and day <em>d</em>.
<p> <em>y</em> must be in the range 1752..8000, <em>m</em> must be in the range
1..12, and <em>d</em> must be in the range 1..31.
<p> <b>Warning:</b> If <em>y</em> is in the range 0..99, it is interpreted as
1900..1999.
<p> <p>See also <a href="#isValid">isValid</a>().

<h3 class=fn><a href="tqdate.html">TQDate</a> <a name="addDays"></a>TQDate::addDays ( int&nbsp;ndays ) const
</h3>
Returns a TQDate object containing a date <em>ndays</em> later than the
date of this object (or earlier if <em>ndays</em> is negative).
<p> <p>See also <a href="#addMonths">addMonths</a>(), <a href="#addYears">addYears</a>(), and <a href="#daysTo">daysTo</a>().

<h3 class=fn><a href="tqdate.html">TQDate</a> <a name="addMonths"></a>TQDate::addMonths ( int&nbsp;nmonths ) const
</h3>
Returns a TQDate object containing a date <em>nmonths</em> later than the
date of this object (or earlier if <em>nmonths</em> is negative).
<p> <p>See also <a href="#addDays">addDays</a>() and <a href="#addYears">addYears</a>().

<h3 class=fn><a href="tqdate.html">TQDate</a> <a name="addYears"></a>TQDate::addYears ( int&nbsp;nyears ) const
</h3>
Returns a TQDate object containing a date <em>nyears</em> later than the
date of this object (or earlier if <em>nyears</em> is negative).
<p> <p>See also <a href="#addDays">addDays</a>() and <a href="#addMonths">addMonths</a>().

<h3 class=fn><a href="tqdate.html">TQDate</a> <a name="currentDate"></a>TQDate::currentDate ( <a href="tqt.html#TimeSpec-enum">TQt::TimeSpec</a>&nbsp;ts )<tt> [static]</tt>
</h3>
Returns the current date, as reported by the system clock, for the
TimeSpec <em>ts</em>. The default TimeSpec is LocalTime.
<p> <p>See also <a href="tqtime.html#currentTime">TQTime::currentTime</a>(), <a href="tqdatetime.html#currentDateTime">TQDateTime::currentDateTime</a>(), and <a href="tqt.html#TimeSpec-enum">TQt::TimeSpec</a>.

<p>Example: <a href="dclock-example.html#x1098">dclock/dclock.cpp</a>.
<h3 class=fn><a href="tqdate.html">TQDate</a> <a name="currentDate-2"></a>TQDate::currentDate ()<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the current date, as reported by the system clock.
<p> <p>See also <a href="tqtime.html#currentTime">TQTime::currentTime</a>() and <a href="tqdatetime.html#currentDateTime">TQDateTime::currentDateTime</a>().

<h3 class=fn>int <a name="day"></a>TQDate::day () const
</h3>
Returns the day of the month (1..31) of this date.
<p> <p>See also <a href="#year">year</a>(), <a href="#month">month</a>(), and <a href="#dayOfWeek">dayOfWeek</a>().

<p>Example: <a href="dclock-example.html#x1099">dclock/dclock.cpp</a>.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="dayName"></a>TQDate::dayName ( int&nbsp;weekday )<tt> [static]</tt>
</h3>

<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Use <a href="#shortDayName">shortDayName</a>() instead.

<h3 class=fn>int <a name="dayOfWeek"></a>TQDate::dayOfWeek () const
</h3>
Returns the weekday (Monday=1..Sunday=7) for this date.
<p> <p>See also <a href="#day">day</a>() and <a href="#dayOfYear">dayOfYear</a>().

<h3 class=fn>int <a name="dayOfYear"></a>TQDate::dayOfYear () const
</h3>
Returns the day of the year (1..365) for this date.
<p> <p>See also <a href="#day">day</a>() and <a href="#dayOfWeek">dayOfWeek</a>().

<h3 class=fn>int <a name="daysInMonth"></a>TQDate::daysInMonth () const
</h3>
Returns the number of days in the month (28..31) for this date.
<p> <p>See also <a href="#day">day</a>() and <a href="#daysInYear">daysInYear</a>().

<h3 class=fn>int <a name="daysInYear"></a>TQDate::daysInYear () const
</h3>
Returns the number of days in the year (365 or 366) for this date.
<p> <p>See also <a href="#day">day</a>() and <a href="#daysInMonth">daysInMonth</a>().

<h3 class=fn>int <a name="daysTo"></a>TQDate::daysTo ( const&nbsp;<a href="tqdate.html">TQDate</a>&nbsp;&amp;&nbsp;d ) const
</h3>
Returns the number of days from this date to <em>d</em> (which is
negative if <em>d</em> is earlier than this date).
<p> Example:
<pre>
        TQDate d1( 1995, 5, 17 );  // May 17th 1995
        TQDate d2( 1995, 5, 20 );  // May 20th 1995
        d1.<a href="#daysTo">daysTo</a>( d2 );          // returns 3
        d2.<a href="#daysTo">daysTo</a>( d1 );          // returns -3
    </pre>
 
<p> <p>See also <a href="#addDays">addDays</a>().

<h3 class=fn><a href="tqdate.html">TQDate</a> <a name="fromString"></a>TQDate::fromString ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;s, <a href="tqt.html#DateFormat-enum">TQt::DateFormat</a>&nbsp;f = TQt::TextDate )<tt> [static]</tt>
</h3>
Returns the TQDate represented by the string <em>s</em>, using the format
<em>f</em>, or an invalid date if the string cannot be parsed.
<p> Note for <a href="tqt.html#DateFormat-enum">TQt::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> <b>Warning:</b> <a href="tqt.html#DateFormat-enum">TQt::LocalDate</a> cannot be used here.

<h3 class=fn>bool <a name="isNull"></a>TQDate::isNull () const
</h3>

<p> Returns TRUE if the date is null; otherwise returns FALSE. A null
date is invalid.
<p> <p>See also <a href="#isValid">isValid</a>().

<h3 class=fn>bool <a name="isValid"></a>TQDate::isValid () const
</h3>
Returns TRUE if this date is valid; otherwise returns FALSE.
<p> <p>See also <a href="#isNull">isNull</a>().

<h3 class=fn>bool <a name="isValid-2"></a>TQDate::isValid ( int&nbsp;y, int&nbsp;m, int&nbsp;d )<tt> [static]</tt>
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns TRUE if the specified date (year <em>y</em>, month <em>m</em> and day
<em>d</em>) is valid; otherwise returns FALSE.
<p> Example:
<pre>
    TQDate::<a href="#isValid">isValid</a>( 2002, 5, 17 );  // TRUE   May 17th 2002 is valid
    TQDate::<a href="#isValid">isValid</a>( 2002, 2, 30 );  // FALSE  Feb 30th does not exist
    TQDate::<a href="#isValid">isValid</a>( 2004, 2, 29 );  // TRUE   2004 is a leap year
    TQDate::<a href="#isValid">isValid</a>( 1202, 6, 6 );   // FALSE  1202 is pre-Gregorian
    </pre>
 
<p> <b>Warning:</b> A <em>y</em> value in the range 00..99 is interpreted as
1900..1999.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#setYMD">setYMD</a>().

<h3 class=fn>bool <a name="leapYear"></a>TQDate::leapYear ( int&nbsp;y )<tt> [static]</tt>
</h3>
Returns TRUE if the specified year <em>y</em> is a leap year; otherwise
returns FALSE.

<h3 class=fn><a href="tqstring.html">TQString</a> <a name="longDayName"></a>TQDate::longDayName ( int&nbsp;weekday )<tt> [static]</tt>
</h3>
Returns the long name of the <em>weekday</em>.
<p> 1 = "Monday", 2 = "Tuesday", ... 7 = "Sunday"
<p> The day names will be localized according to the system's locale
settings.
<p> <p>See also <a href="#toString">toString</a>(), <a href="#shortDayName">shortDayName</a>(), <a href="#shortMonthName">shortMonthName</a>(), and <a href="#longMonthName">longMonthName</a>().

<h3 class=fn><a href="tqstring.html">TQString</a> <a name="longMonthName"></a>TQDate::longMonthName ( int&nbsp;month )<tt> [static]</tt>
</h3>
Returns the long name of the <em>month</em>.
<p> 1 = "January", 2 = "February", ... 12 = "December"
<p> The month names will be localized according to the system's locale
settings.
<p> <p>See also <a href="#toString">toString</a>(), <a href="#shortMonthName">shortMonthName</a>(), <a href="#shortDayName">shortDayName</a>(), and <a href="#longDayName">longDayName</a>().

<h3 class=fn>int <a name="month"></a>TQDate::month () const
</h3>
Returns the month (January=1..December=12) of this date.
<p> <p>See also <a href="#year">year</a>() and <a href="#day">day</a>().

<p>Example: <a href="dclock-example.html#x1100">dclock/dclock.cpp</a>.
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="monthName"></a>TQDate::monthName ( int&nbsp;month )<tt> [static]</tt>
</h3>

<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Use <a href="#shortMonthName">shortMonthName</a>() instead.

<h3 class=fn>bool <a name="operator!-eq"></a>TQDate::operator!= ( const&nbsp;<a href="tqdate.html">TQDate</a>&nbsp;&amp;&nbsp;d ) const
</h3>

<p> Returns TRUE if this date is different from <em>d</em>; otherwise returns FALSE.

<h3 class=fn>bool <a name="operator-lt"></a>TQDate::operator&lt; ( const&nbsp;<a href="tqdate.html">TQDate</a>&nbsp;&amp;&nbsp;d ) const
</h3>

<p> Returns TRUE if this date is earlier than <em>d</em>, otherwise returns FALSE.

<h3 class=fn>bool <a name="operator-lt-eq"></a>TQDate::operator&lt;= ( const&nbsp;<a href="tqdate.html">TQDate</a>&nbsp;&amp;&nbsp;d ) const
</h3>

<p> Returns TRUE if this date is earlier than or equal to <em>d</em>,
otherwise returns FALSE.

<h3 class=fn>bool <a name="operator-eq-eq"></a>TQDate::operator== ( const&nbsp;<a href="tqdate.html">TQDate</a>&nbsp;&amp;&nbsp;d ) const
</h3>

<p> Returns TRUE if this date is equal to <em>d</em>; otherwise returns FALSE.

<h3 class=fn>bool <a name="operator-gt"></a>TQDate::operator&gt; ( const&nbsp;<a href="tqdate.html">TQDate</a>&nbsp;&amp;&nbsp;d ) const
</h3>

<p> Returns TRUE if this date is later than <em>d</em>, otherwise returns FALSE.

<h3 class=fn>bool <a name="operator-gt-eq"></a>TQDate::operator&gt;= ( const&nbsp;<a href="tqdate.html">TQDate</a>&nbsp;&amp;&nbsp;d ) const
</h3>

<p> Returns TRUE if this date is later than or equal to <em>d</em>,
otherwise returns FALSE.

<h3 class=fn>bool <a name="setYMD"></a>TQDate::setYMD ( int&nbsp;y, int&nbsp;m, int&nbsp;d )
</h3>
Sets the date's year <em>y</em>, month <em>m</em> and day <em>d</em>.
<p> <em>y</em> must be in the range 1752..8000, <em>m</em> must be in the range
1..12, and <em>d</em> must be in the range 1..31.
<p> <b>Warning:</b> If <em>y</em> is in the range 0..99, it is interpreted as
1900..1999.
<p> Returns TRUE if the date is valid; otherwise returns FALSE.

<h3 class=fn><a href="tqstring.html">TQString</a> <a name="shortDayName"></a>TQDate::shortDayName ( int&nbsp;weekday )<tt> [static]</tt>
</h3>
Returns the name of the <em>weekday</em>.
<p> 1 = "Mon", 2 = "Tue", ... 7 = "Sun"
<p> The day names will be localized according to the system's locale
settings.
<p> <p>See also <a href="#toString">toString</a>(), <a href="#shortMonthName">shortMonthName</a>(), <a href="#longMonthName">longMonthName</a>(), and <a href="#longDayName">longDayName</a>().

<h3 class=fn><a href="tqstring.html">TQString</a> <a name="shortMonthName"></a>TQDate::shortMonthName ( int&nbsp;month )<tt> [static]</tt>
</h3>
Returns the name of the <em>month</em>.
<p> 1 = "Jan", 2 = "Feb", ... 12 = "Dec"
<p> The month names will be localized according to the system's locale
settings.
<p> <p>See also <a href="#toString">toString</a>(), <a href="#longMonthName">longMonthName</a>(), <a href="#shortDayName">shortDayName</a>(), and <a href="#longDayName">longDayName</a>().

<h3 class=fn><a href="tqstring.html">TQString</a> <a name="toString"></a>TQDate::toString ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;format ) const
</h3>
Returns the date as a string. The <em>format</em> parameter determines
the format of the result string.
<p> These expressions may be used:
<p> <center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Expression <th valign="top">Output
<tr bgcolor="#f0f0f0"> <td valign="top">d <td valign="top">the day as number without a leading zero (1-31)
<tr bgcolor="#d0d0d0"> <td valign="top">dd <td valign="top">the day as number with a leading zero (01-31)
<tr bgcolor="#f0f0f0"> <td valign="top">ddd
<td valign="top">the abbreviated localized day name (e.g. 'Mon'..'Sun').
Uses <a href="#shortDayName">TQDate::shortDayName</a>().
<tr bgcolor="#d0d0d0"> <td valign="top">dddd
<td valign="top">the long localized day name (e.g. 'Monday'..'Sunday').
Uses <a href="#longDayName">TQDate::longDayName</a>().
<tr bgcolor="#f0f0f0"> <td valign="top">M <td valign="top">the month as number without a leading zero (1-12)
<tr bgcolor="#d0d0d0"> <td valign="top">MM <td valign="top">the month as number with a leading zero (01-12)
<tr bgcolor="#f0f0f0"> <td valign="top">MMM
<td valign="top">the abbreviated localized month name (e.g. 'Jan'..'Dec').
Uses <a href="#shortMonthName">TQDate::shortMonthName</a>().
<tr bgcolor="#d0d0d0"> <td valign="top">MMMM
<td valign="top">the long localized month name (e.g. 'January'..'December').
Uses <a href="#longMonthName">TQDate::longMonthName</a>().
<tr bgcolor="#f0f0f0"> <td valign="top">yy <td valign="top">the year as two digit number (00-99)
<tr bgcolor="#d0d0d0"> <td valign="top">yyyy <td valign="top">the year as four digit number (1752-8000)
</table></center>
<p> All other input characters will be ignored.
<p> Example format strings (assuming that the TQDate is the
20<sup><small>th</small></sup> July 1969):
<center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#a2c511"> <th valign="top">Format <th valign="top">Result
<tr bgcolor="#f0f0f0"> <td valign="top">dd.MM.yyyy	  <td valign="top" colspan="1" rowspan="1"> 20.07.1969
<tr bgcolor="#d0d0d0"> <td valign="top">ddd MMMM d yy <td valign="top" colspan="1" rowspan="1"> Sun July 20 69
</table></center>
<p> If the date is an invalid date, then <a href="tqstring.html#TQString-null">TQString::null</a> will be returned.
<p> <p>See also <a href="tqdatetime.html#toString">TQDateTime::toString</a>() and <a href="tqtime.html#toString">TQTime::toString</a>().

<p> 
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="toString-2"></a>TQDate::toString ( <a href="tqt.html#DateFormat-enum">TQt::DateFormat</a>&nbsp;f = TQt::TextDate ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the date as a string. The <em>f</em> parameter determines the
format of the string.
<p> If <em>f</em> is <a href="tqt.html#DateFormat-enum">TQt::TextDate</a>, the string format is "Sat May 20 1995"
(using the <a href="#shortDayName">shortDayName</a>() and <a href="#shortMonthName">shortMonthName</a>() functions to
generate the string, so the day and month names are locale
specific).
<p> If <em>f</em> is <a href="tqt.html#DateFormat-enum">TQt::ISODate</a>, the string format corresponds to the
ISO 8601 specification for representations of dates, which is
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> If <em>f</em> is <a href="tqt.html#DateFormat-enum">TQt::LocalDate</a>, the string format depends on the
locale settings of the system.
<p> If the date is an invalid date, then <a href="tqstring.html#TQString-null">TQString::null</a> will be returned.
<p> <p>See also <a href="#shortDayName">shortDayName</a>() and <a href="#shortMonthName">shortMonthName</a>().

<h3 class=fn>int <a name="weekNumber"></a>TQDate::weekNumber ( int&nbsp;*&nbsp;yearNumber = 0 ) const
</h3>
Returns the week number (1 to 53), and stores the year in <em>*yearNumber</em> unless <em>yearNumber</em> is null (the default).
<p> Returns 0 if the date is invalid.
<p> In accordance with ISO 8601, weeks start on Monday and the first
Thursday of a year is always in week 1 of that year. Most years
have 52 weeks, but some have 53.
<p> <em>*yearNumber</em> is not always the same as <a href="#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> 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="#isValid">isValid</a>().

<h3 class=fn>int <a name="year"></a>TQDate::year () const
</h3>
Returns the year (1752..8000) of this date.
<p> <p>See also <a href="#month">month</a>() and <a href="#day">day</a>().

<hr><h2>Related Functions</h2>
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="tqdate.html">TQDate</a>&nbsp;&amp;&nbsp;d )
</h3>

<p> Writes the date, <em>d</em>, to the data stream, <em>s</em>.
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.

<h3 class=fn><a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, <a href="tqdate.html">TQDate</a>&nbsp;&amp;&nbsp;d )
</h3>

<p> Reads a date from the stream <em>s</em> into <em>d</em>.
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>