diff options
Diffstat (limited to 'doc/html/qdate.html')
-rw-r--r-- | doc/html/qdate.html | 459 |
1 files changed, 459 insertions, 0 deletions
diff --git a/doc/html/qdate.html b/doc/html/qdate.html new file mode 100644 index 000000000..76768d112 --- /dev/null +++ b/doc/html/qdate.html @@ -0,0 +1,459 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/tools/qdatetime.cpp:201 --> +<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 Classes</font></a> + | <a href="mainclasses.html"> +<font color="#004faf">Main Classes</font></a> + | <a href="annotated.html"> +<font color="#004faf">Annotated</font></a> + | <a href="groups.html"> +<font color="#004faf">Grouped 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 <<a href="qdatetime-h.html">qdatetime.h</a>></tt> +<p><a href="qdate-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 y, int m, int 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 * yearNumber = 0 ) const</li> +<li class=fn>TQString <a href="#toString-2"><b>toString</b></a> ( TQt::DateFormat f = TQt::TextDate ) const</li> +<li class=fn>TQString <a href="#toString"><b>toString</b></a> ( const TQString & format ) const</li> +<li class=fn>bool <a href="#setYMD"><b>setYMD</b></a> ( int y, int m, int d )</li> +<li class=fn>TQDate <a href="#addDays"><b>addDays</b></a> ( int ndays ) const</li> +<li class=fn>TQDate <a href="#addMonths"><b>addMonths</b></a> ( int nmonths ) const</li> +<li class=fn>TQDate <a href="#addYears"><b>addYears</b></a> ( int nyears ) const</li> +<li class=fn>int <a href="#daysTo"><b>daysTo</b></a> ( const TQDate & d ) const</li> +<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const TQDate & d ) const</li> +<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const TQDate & d ) const</li> +<li class=fn>bool <a href="#operator-lt"><b>operator<</b></a> ( const TQDate & d ) const</li> +<li class=fn>bool <a href="#operator-lt-eq"><b>operator<=</b></a> ( const TQDate & d ) const</li> +<li class=fn>bool <a href="#operator-gt"><b>operator></b></a> ( const TQDate & d ) const</li> +<li class=fn>bool <a href="#operator-gt-eq"><b>operator>=</b></a> ( const TQDate & d ) const</li> +</ul> +<h2>Static Public Members</h2> +<ul> +<li class=fn>TQString monthName ( int month ) <em>(obsolete)</em></li> +<li class=fn>TQString dayName ( int weekday ) <em>(obsolete)</em></li> +<li class=fn>TQString <a href="#shortMonthName"><b>shortMonthName</b></a> ( int month )</li> +<li class=fn>TQString <a href="#shortDayName"><b>shortDayName</b></a> ( int weekday )</li> +<li class=fn>TQString <a href="#longMonthName"><b>longMonthName</b></a> ( int month )</li> +<li class=fn>TQString <a href="#longDayName"><b>longDayName</b></a> ( int 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 ts )</li> +<li class=fn>TQDate <a href="#fromString"><b>fromString</b></a> ( const TQString & s, TQt::DateFormat f = TQt::TextDate )</li> +<li class=fn>bool <a href="#isValid-2"><b>isValid</b></a> ( int y, int m, int d )</li> +<li class=fn>bool <a href="#leapYear"><b>leapYear</b></a> ( int y )</li> +</ul> +<h2>Related Functions</h2> +<ul> +<li class=fn>TQDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQDataStream & s, const TQDate & d )</li> +<li class=fn>TQDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQDataStream & s, TQDate & 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="qtime.html">TQTime</a>, <a href="qdatetime.html">TQDateTime</a>, <a href="qdateedit.html">TQDateEdit</a>, <a href="qdatetimeedit.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 y, int m, int 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="qdate.html">TQDate</a> <a name="addDays"></a>TQDate::addDays ( int 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="qdate.html">TQDate</a> <a name="addMonths"></a>TQDate::addMonths ( int 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="qdate.html">TQDate</a> <a name="addYears"></a>TQDate::addYears ( int 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="qdate.html">TQDate</a> <a name="currentDate"></a>TQDate::currentDate ( <a href="qt.html#TimeSpec-enum">TQt::TimeSpec</a> 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="qtime.html#currentTime">TQTime::currentTime</a>(), <a href="qdatetime.html#currentDateTime">TQDateTime::currentDateTime</a>(), and <a href="qt.html#TimeSpec-enum">TQt::TimeSpec</a>. + +<p>Example: <a href="dclock-example.html#x1098">dclock/dclock.cpp</a>. +<h3 class=fn><a href="qdate.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="qtime.html#currentTime">TQTime::currentTime</a>() and <a href="qdatetime.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="qstring.html">TQString</a> <a name="dayName"></a>TQDate::dayName ( int 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 <a href="qdate.html">TQDate</a> & 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="qdate.html">TQDate</a> <a name="fromString"></a>TQDate::fromString ( const <a href="qstring.html">TQString</a> & s, <a href="qt.html#DateFormat-enum">TQt::DateFormat</a> 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="qt.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="qt.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 y, int m, int 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 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="qstring.html">TQString</a> <a name="longDayName"></a>TQDate::longDayName ( int 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="qstring.html">TQString</a> <a name="longMonthName"></a>TQDate::longMonthName ( int 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="qstring.html">TQString</a> <a name="monthName"></a>TQDate::monthName ( int 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 <a href="qdate.html">TQDate</a> & 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< ( const <a href="qdate.html">TQDate</a> & 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<= ( const <a href="qdate.html">TQDate</a> & 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 <a href="qdate.html">TQDate</a> & 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> ( const <a href="qdate.html">TQDate</a> & 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>= ( const <a href="qdate.html">TQDate</a> & 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 y, int m, int 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="qstring.html">TQString</a> <a name="shortDayName"></a>TQDate::shortDayName ( int 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="qstring.html">TQString</a> <a name="shortMonthName"></a>TQDate::shortMonthName ( int 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="qstring.html">TQString</a> <a name="toString"></a>TQDate::toString ( const <a href="qstring.html">TQString</a> & 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="qstring.html#TQString-null">TQString::null</a> will be returned. +<p> <p>See also <a href="qdatetime.html#toString">TQDateTime::toString</a>() and <a href="qtime.html#toString">TQTime::toString</a>(). + +<p> +<h3 class=fn><a href="qstring.html">TQString</a> <a name="toString-2"></a>TQDate::toString ( <a href="qt.html#DateFormat-enum">TQt::DateFormat</a> 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="qt.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="qt.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="qt.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="qstring.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 * 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="qdatastream.html">TQDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="qdatastream.html">TQDataStream</a> & s, const <a href="qdate.html">TQDate</a> & 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="qdatastream.html">TQDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="qdatastream.html">TQDataStream</a> & s, <a href="qdate.html">TQDate</a> & 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 © 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 © 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> |