Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 336

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qdatetime.cpp -->
  <title>QDate Class | Qt Core 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QDate</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#no-year-0">No Year 0</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QDate Class</h1>
<!-- $$$QDate-brief -->
<p>The <a href="qdate.html">QDate</a> class provides date functions. <a href="#details">More...</a></p>
<!-- @@@QDate -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QDate&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr></table></div><ul>
<li><a href="qdate-members.html">List of all members, including inherited members</a></li>
<li><a href="qdate-obsolete.html">Obsolete members</a></li>
</ul>
<p><b>Note:</b> All functions in this class are reentrant.</p>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#MonthNameType-enum">MonthNameType</a></b> { DateFormat, StandaloneFormat }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#QDate">QDate</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#QDate-2">QDate</a></b>(int <i>y</i>, int <i>m</i>, int <i>d</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDate </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#addDays">addDays</a></b>(qint64 <i>ndays</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDate </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#addMonths">addMonths</a></b>(int <i>nmonths</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDate </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#addYears">addYears</a></b>(int <i>nyears</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#day">day</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#dayOfWeek">dayOfWeek</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#dayOfYear">dayOfYear</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#daysInMonth">daysInMonth</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#daysInYear">daysInYear</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qint64 </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#daysTo">daysTo</a></b>(const QDate &amp;<i>d</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#getDate">getDate</a></b>(int *<i>year</i>, int *<i>month</i>, int *<i>day</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#isNull">isNull</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#isValid">isValid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#month">month</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#setDate">setDate</a></b>(int <i>year</i>, int <i>month</i>, int <i>day</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qint64 </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#toJulianDay">toJulianDay</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#toString">toString</a></b>(const QString &amp;<i>format</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#toString-1">toString</a></b>(Qt::DateFormat <i>format</i> = Qt::TextDate) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#weekNumber">weekNumber</a></b>(int *<i>yearNumber</i> = Q_NULLPTR) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#year">year</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#operator-not-eq">operator!=</a></b>(const QDate &amp;<i>d</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#operator-lt">operator&lt;</a></b>(const QDate &amp;<i>d</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#operator-lt-eq">operator&lt;=</a></b>(const QDate &amp;<i>d</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#operator-eq-eq">operator==</a></b>(const QDate &amp;<i>d</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#operator-gt">operator&gt;</a></b>(const QDate &amp;<i>d</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#operator-gt-eq">operator&gt;=</a></b>(const QDate &amp;<i>d</i>) const</td></tr>
</table></div>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QDate </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#currentDate">currentDate</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDate </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#fromJulianDay">fromJulianDay</a></b>(qint64 <i>jd</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDate </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#fromString">fromString</a></b>(const QString &amp;<i>string</i>, Qt::DateFormat <i>format</i> = Qt::TextDate)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDate </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#fromString-1">fromString</a></b>(const QString &amp;<i>string</i>, const QString &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#isLeapYear">isLeapYear</a></b>(int <i>year</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#isValid-1">isValid</a></b>(int <i>year</i>, int <i>month</i>, int <i>day</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#longDayName">longDayName</a></b>(int <i>weekday</i>, MonthNameType <i>type</i> = DateFormat)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#longMonthName">longMonthName</a></b>(int <i>month</i>, MonthNameType <i>type</i> = DateFormat)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#shortDayName">shortDayName</a></b>(int <i>weekday</i>, MonthNameType <i>type</i> = DateFormat)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qdate.html#shortMonthName">shortMonthName</a></b>(int <i>month</i>, MonthNameType <i>type</i> = DateFormat)</td></tr>
</table></div>
<a name="related-non-members"></a>
<h2 id="related-non-members">Related Non-Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp;</td><td class="memItemRight bottomAlign"><b><a href="qdate.html#operator-lt-lt">operator&lt;&lt;</a></b>(QDataStream &amp;<i>out</i>, const QDate &amp;<i>date</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp;</td><td class="memItemRight bottomAlign"><b><a href="qdate.html#operator-gt-gt">operator&gt;&gt;</a></b>(QDataStream &amp;<i>in</i>, QDate &amp;<i>date</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QDate-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qdate.html">QDate</a> class provides date functions.</p>
<p>A <a href="qdate.html">QDate</a> object contains a calendar date, i.e&#x2e; year, month, and day numbers, in the 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 <a href="qdate.html">QDate</a> object is typically created by giving the year, month, and day numbers explicitly. Note that <a href="qdate.html">QDate</a> interprets two digit years as is, i.e&#x2e;, years 0 - 99. A <a href="qdate.html">QDate</a> can also be constructed with the static function <a href="qdate.html#currentDate">currentDate</a>(), which creates a <a href="qdate.html">QDate</a> object containing the system clock's date. An explicit date can also be set using <a href="qdate.html#setDate">setDate</a>(). The <a href="qdate.html#fromString">fromString</a>() function returns a <a href="qdate.html">QDate</a> 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><a href="qdate.html">QDate</a> provides a full set of operators to compare two <a href="qdate.html">QDate</a> 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 a date is in a leap year.</p>
<a name="no-year-0"></a>
<a name="no-year-0"></a>
<h4 >No Year 0</h4>
<p>There is no year 0. Dates in that year are considered invalid. The year -1 is the year &quot;1 before Christ&quot; or &quot;1 before current era.&quot; The day before 1 January 1 CE is 31 December 1 BCE.</p>
<a name="range-of-valid-dates"></a>
<h4 >Range of Valid Dates</h4>
<p>Dates are stored internally as a Julian Day number, an integer count of every day in a contiguous range, with 24 November 4714 BCE in the Gregorian calendar being Julian Day 0 (1 January 4713 BCE in the Julian calendar). As well as being an efficient and accurate way of storing an absolute date, it is suitable for converting a Date into other calendar systems such as Hebrew, Islamic or Chinese. The Julian Day number can be obtained using <a href="qdate.html#toJulianDay">QDate::toJulianDay</a>() and can be set using <a href="qdate.html#fromJulianDay">QDate::fromJulianDay</a>().</p>
<p>The range of dates able to be stored by <a href="qdate.html">QDate</a> as a Julian Day number is for technical reasons limited to between -784350574879 and 784354017364, which means from before 2 billion BCE to after 2 billion CE.</p>
</div>
<p><b>See also </b><a href="qtime.html">QTime</a>, <a href="qdatetime.html">QDateTime</a>, <a href="../qtwidgets/qdateedit.html">QDateEdit</a>, <a href="../qtwidgets/qdatetimeedit.html">QDateTimeEdit</a>, and <a href="../qtwidgets/qcalendarwidget.html">QCalendarWidget</a>.</p>
<!-- @@@QDate -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$MonthNameType$$$DateFormat$$$StandaloneFormat -->
<h3 class="fn" id="MonthNameType-enum"><a name="MonthNameType-enum"></a>enum QDate::<span class="name">MonthNameType</span></h3>
<p>This enum describes the types of the string representation used for the month name.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QDate::DateFormat</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">This type of name can be used for date-to-string formatting.</td></tr>
<tr><td class="topAlign"><code>QDate::StandaloneFormat</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">This type is used when you need to enumerate months or weekdays. Usually standalone names are represented in singular forms with capitalized first letter.</td></tr>
</table></div>
<p>This enum was introduced or modified in  Qt 4.5.</p>
<!-- @@@MonthNameType -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QDate[overload1]$$$QDate -->
<h3 class="fn" id="QDate"><a name="QDate"></a>QDate::<span class="name">QDate</span>()</h3>
<p>Constructs a null date. Null dates are invalid.</p>
<p><b>See also </b><a href="qdate.html#isNull">isNull</a>() and <a href="qdate.html#isValid">isValid</a>().</p>
<!-- @@@QDate -->
<!-- $$$QDate$$$QDateintintint -->
<h3 class="fn" id="QDate-2"><a name="QDate-2"></a>QDate::<span class="name">QDate</span>(<span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>m</i>, <span class="type">int</span> <i>d</i>)</h3>
<p>Constructs a date with year <i>y</i>, month <i>m</i> and day <i>d</i>.</p>
<p>If the specified date is invalid, the date is not set and <a href="qdate.html#isValid">isValid</a>() returns <code>false</code>.</p>
<p><b>Warning:</b> Years 1 to 99 are interpreted as is. Year 0 is invalid.</p>
<p><b>See also </b><a href="qdate.html#isValid">isValid</a>().</p>
<!-- @@@QDate -->
<!-- $$$addDays[overload1]$$$addDaysqint64 -->
<h3 class="fn" id="addDays"><a name="addDays"></a><span class="type"><a href="qdate.html#QDate">QDate</a></span> QDate::<span class="name">addDays</span>(<span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>ndays</i>) const</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>Returns a null date if the current date is invalid or the new date is out of range.</p>
<p><b>See also </b><a href="qdate.html#addMonths">addMonths</a>(), <a href="qdate.html#addYears">addYears</a>(), and <a href="qdate.html#daysTo">daysTo</a>().</p>
<!-- @@@addDays -->
<!-- $$$addMonths[overload1]$$$addMonthsint -->
<h3 class="fn" id="addMonths"><a name="addMonths"></a><span class="type"><a href="qdate.html#QDate">QDate</a></span> QDate::<span class="name">addMonths</span>(<span class="type">int</span> <i>nmonths</i>) const</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><b>Note: </b>If the ending day/month combination does not exist in the resulting month/year, this function will return a date that is the latest valid date.</p><p><b>See also </b><a href="qdate.html#addDays">addDays</a>() and <a href="qdate.html#addYears">addYears</a>().</p>
<!-- @@@addMonths -->
<!-- $$$addYears[overload1]$$$addYearsint -->
<h3 class="fn" id="addYears"><a name="addYears"></a><span class="type"><a href="qdate.html#QDate">QDate</a></span> QDate::<span class="name">addYears</span>(<span class="type">int</span> <i>nyears</i>) const</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><b>Note: </b>If the ending day/month combination does not exist in the resulting year (i.e&#x2e;, if the date was Feb 29 and the final year is not a leap year), this function will return a date that is the latest valid date (that is, Feb 28).</p><p><b>See also </b><a href="qdate.html#addDays">addDays</a>() and <a href="qdate.html#addMonths">addMonths</a>().</p>
<!-- @@@addYears -->
<!-- $$$currentDate[overload1]$$$currentDate -->
<h3 class="fn" id="currentDate"><a name="currentDate"></a><code>[static] </code><span class="type"><a href="qdate.html#QDate">QDate</a></span> QDate::<span class="name">currentDate</span>()</h3>
<p>Returns the current date, as reported by the system clock.</p>
<p><b>See also </b><a href="qtime.html#currentTime">QTime::currentTime</a>() and <a href="qdatetime.html#currentDateTime">QDateTime::currentDateTime</a>().</p>
<!-- @@@currentDate -->
<!-- $$$day[overload1]$$$day -->
<h3 class="fn" id="day"><a name="day"></a><span class="type">int</span> QDate::<span class="name">day</span>() const</h3>
<p>Returns the day of the month (1 to 31) of this date.</p>
<p>Returns 0 if the date is invalid.</p>
<p><b>See also </b><a href="qdate.html#year">year</a>(), <a href="qdate.html#month">month</a>(), and <a href="qdate.html#dayOfWeek">dayOfWeek</a>().</p>
<!-- @@@day -->
<!-- $$$dayOfWeek[overload1]$$$dayOfWeek -->
<h3 class="fn" id="dayOfWeek"><a name="dayOfWeek"></a><span class="type">int</span> QDate::<span class="name">dayOfWeek</span>() const</h3>
<p>Returns the weekday (1 = Monday to 7 = Sunday) for this date.</p>
<p>Returns 0 if the date is invalid.</p>
<p><b>See also </b><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>
<!-- @@@dayOfWeek -->
<!-- $$$dayOfYear[overload1]$$$dayOfYear -->
<h3 class="fn" id="dayOfYear"><a name="dayOfYear"></a><span class="type">int</span> QDate::<span class="name">dayOfYear</span>() const</h3>
<p>Returns the day of the year (1 to 365 or 366 on leap years) for this date.</p>
<p>Returns 0 if the date is invalid.</p>
<p><b>See also </b><a href="qdate.html#day">day</a>() and <a href="qdate.html#dayOfWeek">dayOfWeek</a>().</p>
<!-- @@@dayOfYear -->
<!-- $$$daysInMonth[overload1]$$$daysInMonth -->
<h3 class="fn" id="daysInMonth"><a name="daysInMonth"></a><span class="type">int</span> QDate::<span class="name">daysInMonth</span>() const</h3>
<p>Returns the number of days in the month (28 to 31) for this date.</p>
<p>Returns 0 if the date is invalid.</p>
<p><b>See also </b><a href="qdate.html#day">day</a>() and <a href="qdate.html#daysInYear">daysInYear</a>().</p>
<!-- @@@daysInMonth -->
<!-- $$$daysInYear[overload1]$$$daysInYear -->
<h3 class="fn" id="daysInYear"><a name="daysInYear"></a><span class="type">int</span> QDate::<span class="name">daysInYear</span>() const</h3>
<p>Returns the number of days in the year (365 or 366) for this date.</p>
<p>Returns 0 if the date is invalid.</p>
<p><b>See also </b><a href="qdate.html#day">day</a>() and <a href="qdate.html#daysInMonth">daysInMonth</a>().</p>
<!-- @@@daysInYear -->
<!-- $$$daysTo[overload1]$$$daysToconstQDate& -->
<h3 class="fn" id="daysTo"><a name="daysTo"></a><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QDate::<span class="name">daysTo</span>(const <span class="type"><a href="qdate.html#QDate">QDate</a></span> &amp;<i>d</i>) const</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>Returns 0 if either date is invalid.</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qdate.html#QDate">QDate</a></span> d1(<span class="number">1995</span><span class="operator">,</span> <span class="number">5</span><span class="operator">,</span> <span class="number">17</span>);  <span class="comment">// May 17, 1995</span>
  <span class="type"><a href="qdate.html#QDate">QDate</a></span> d2(<span class="number">1995</span><span class="operator">,</span> <span class="number">5</span><span class="operator">,</span> <span class="number">20</span>);  <span class="comment">// May 20, 1995</span>
  d1<span class="operator">.</span>daysTo(d2);          <span class="comment">// returns 3</span>
  d2<span class="operator">.</span>daysTo(d1);          <span class="comment">// returns -3</span>

</pre>
<p><b>See also </b><a href="qdate.html#addDays">addDays</a>().</p>
<!-- @@@daysTo -->
<!-- $$$fromJulianDay[overload1]$$$fromJulianDayqint64 -->
<h3 class="fn" id="fromJulianDay"><a name="fromJulianDay"></a><code>[static] </code><span class="type"><a href="qdate.html#QDate">QDate</a></span> QDate::<span class="name">fromJulianDay</span>(<span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> <i>jd</i>)</h3>
<p>Converts the Julian day <i>jd</i> to a <a href="qdate.html">QDate</a>.</p>
<p><b>See also </b><a href="qdate.html#toJulianDay">toJulianDay</a>().</p>
<!-- @@@fromJulianDay -->
<!-- $$$fromString[overload1]$$$fromStringconstQString&Qt::DateFormat -->
<h3 class="fn" id="fromString"><a name="fromString"></a><code>[static] </code><span class="type"><a href="qdate.html#QDate">QDate</a></span> QDate::<span class="name">fromString</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>string</i>, <span class="type"><a href="qt.html#DateFormat-enum">Qt::DateFormat</a></span> <i>format</i> = 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&#x2e; &quot;Jan&quot;). Although localized month names can also be used, they depend on the user's locale settings.</p>
<p><b>See also </b><a href="qdate.html#toString">toString</a>() and <a href="qlocale.html#toDate">QLocale::toDate</a>().</p>
<!-- @@@fromString -->
<!-- $$$fromString$$$fromStringconstQString&constQString& -->
<h3 class="fn" id="fromString-1"><a name="fromString-1"></a><code>[static] </code><span class="type"><a href="qdate.html#QDate">QDate</a></span> QDate::<span class="name">fromString</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>string</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>format</i>)</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>These expressions may be used for the format:</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >Expression</th><th >Output</th></tr></thead>
<tr valign="top" class="odd"><td >d</td><td >The day as a number without a leading zero (1 to 31)</td></tr>
<tr valign="top" class="even"><td >dd</td><td >The day as a number with a leading zero (01 to 31)</td></tr>
<tr valign="top" class="odd"><td >ddd</td><td >The abbreviated localized day name (e.g&#x2e; 'Mon' to 'Sun'). Uses the system locale to localize the name, i.e&#x2e; <a href="qlocale.html#system">QLocale::system</a>().</td></tr>
<tr valign="top" class="even"><td >dddd</td><td >The long localized day name (e.g&#x2e; 'Monday' to 'Sunday'). Uses the system locale to localize the name, i.e&#x2e; <a href="qlocale.html#system">QLocale::system</a>().</td></tr>
<tr valign="top" class="odd"><td >M</td><td >The month as a number without a leading zero (1 to 12)</td></tr>
<tr valign="top" class="even"><td >MM</td><td >The month as a number with a leading zero (01 to 12)</td></tr>
<tr valign="top" class="odd"><td >MMM</td><td >The abbreviated localized month name (e.g&#x2e; 'Jan' to 'Dec'). Uses the system locale to localize the name, i.e&#x2e; <a href="qlocale.html#system">QLocale::system</a>().</td></tr>
<tr valign="top" class="even"><td >MMMM</td><td >The long localized month name (e.g&#x2e; 'January' to 'December'). Uses the system locale to localize the name, i.e&#x2e; <a href="qlocale.html#system">QLocale::system</a>().</td></tr>
<tr valign="top" class="odd"><td >yy</td><td >The year as two digit number (00 to 99)</td></tr>
<tr valign="top" class="even"><td >yyyy</td><td >The year as four digit number. If the year is negative, a minus sign is prepended in addition.</td></tr>
</table></div>
<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 class="cpp">

  <span class="type"><a href="qdate.html#QDate">QDate</a></span> date <span class="operator">=</span> <span class="type"><a href="qdate.html#QDate">QDate</a></span><span class="operator">::</span>fromString(<span class="string">&quot;1MM12car2003&quot;</span><span class="operator">,</span> <span class="string">&quot;d'MM'MMcaryyyy&quot;</span>);
  <span class="comment">// date is 1 December 2003</span>

</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 class="cpp">

  <span class="type"><a href="qdate.html#QDate">QDate</a></span> date <span class="operator">=</span> <span class="type"><a href="qdate.html#QDate">QDate</a></span><span class="operator">::</span>fromString(<span class="string">&quot;130&quot;</span><span class="operator">,</span> <span class="string">&quot;Md&quot;</span>); <span class="comment">// invalid</span>

</pre>
<p>For any field that is not represented in the format the following defaults are used:</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >Field</th><th >Default value</th></tr></thead>
<tr valign="top" class="odd"><td >Year</td><td >1900</td></tr>
<tr valign="top" class="even"><td >Month</td><td >1</td></tr>
<tr valign="top" class="odd"><td >Day</td><td >1</td></tr>
</table></div>
<p>The following examples demonstrate the default values:</p>
<pre class="cpp">

  <span class="type"><a href="qdate.html#QDate">QDate</a></span><span class="operator">::</span>fromString(<span class="string">&quot;1.30&quot;</span><span class="operator">,</span> <span class="string">&quot;M.d&quot;</span>);           <span class="comment">// January 30 1900</span>
  <span class="type"><a href="qdate.html#QDate">QDate</a></span><span class="operator">::</span>fromString(<span class="string">&quot;20000110&quot;</span><span class="operator">,</span> <span class="string">&quot;yyyyMMdd&quot;</span>);  <span class="comment">// January 10, 2000</span>
  <span class="type"><a href="qdate.html#QDate">QDate</a></span><span class="operator">::</span>fromString(<span class="string">&quot;20000110&quot;</span><span class="operator">,</span> <span class="string">&quot;yyyyMd&quot;</span>);    <span class="comment">// January 10, 2000</span>

</pre>
<p><b>See also </b><a href="qdate.html#toString">toString</a>(), <a href="qdatetime.html#fromString">QDateTime::fromString</a>(), <a href="qtime.html#fromString">QTime::fromString</a>(), and <a href="qlocale.html#toDate">QLocale::toDate</a>().</p>
<!-- @@@fromString -->
<!-- $$$getDate[overload1]$$$getDateint*int*int* -->
<h3 class="fn" id="getDate"><a name="getDate"></a><span class="type">void</span> QDate::<span class="name">getDate</span>(<span class="type">int</span> *<i>year</i>, <span class="type">int</span> *<i>month</i>, <span class="type">int</span> *<i>day</i>) const</h3>
<p>Extracts the date's year, month, and day, and assigns them to *<i>year</i>, *<i>month</i>, and *<i>day</i>. The pointers may be null.</p>
<p>Returns 0 if the date is invalid.</p>
<p><b>Note: </b>In Qt versions prior to 5.7, this function is marked as non-<code>const</code>.</p><p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><a href="qdate.html#year">year</a>(), <a href="qdate.html#month">month</a>(), <a href="qdate.html#day">day</a>(), and <a href="qdate.html#isValid">isValid</a>().</p>
<!-- @@@getDate -->
<!-- $$$isLeapYear[overload1]$$$isLeapYearint -->
<h3 class="fn" id="isLeapYear"><a name="isLeapYear"></a><code>[static] </code><span class="type">bool</span> QDate::<span class="name">isLeapYear</span>(<span class="type">int</span> <i>year</i>)</h3>
<p>Returns <code>true</code> if the specified <i>year</i> is a leap year; otherwise returns <code>false</code>.</p>
<!-- @@@isLeapYear -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn" id="isNull"><a name="isNull"></a><span class="type">bool</span> QDate::<span class="name">isNull</span>() const</h3>
<p>Returns <code>true</code> if the date is null; otherwise returns <code>false</code>. A null date is invalid.</p>
<p><b>Note: </b>The behavior of this function is equivalent to <a href="qdate.html#isValid">isValid</a>().</p><p><b>See also </b><a href="qdate.html#isValid">isValid</a>().</p>
<!-- @@@isNull -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn" id="isValid"><a name="isValid"></a><span class="type">bool</span> QDate::<span class="name">isValid</span>() const</h3>
<p>Returns <code>true</code> if this date is valid; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qdate.html#isNull">isNull</a>().</p>
<!-- @@@isValid -->
<!-- $$$isValid$$$isValidintintint -->
<h3 class="fn" id="isValid-1"><a name="isValid-1"></a><code>[static] </code><span class="type">bool</span> QDate::<span class="name">isValid</span>(<span class="type">int</span> <i>year</i>, <span class="type">int</span> <i>month</i>, <span class="type">int</span> <i>day</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns <code>true</code> if the specified date (<i>year</i>, <i>month</i>, and <i>day</i>) is valid; otherwise returns <code>false</code>.</p>
<p>Example:</p>
<pre class="cpp">

  <span class="type"><a href="qdate.html#QDate">QDate</a></span><span class="operator">::</span>isValid(<span class="number">2002</span><span class="operator">,</span> <span class="number">5</span><span class="operator">,</span> <span class="number">17</span>);  <span class="comment">// true</span>
  <span class="type"><a href="qdate.html#QDate">QDate</a></span><span class="operator">::</span>isValid(<span class="number">2002</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">30</span>);  <span class="comment">// false (Feb 30 does not exist)</span>
  <span class="type"><a href="qdate.html#QDate">QDate</a></span><span class="operator">::</span>isValid(<span class="number">2004</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">29</span>);  <span class="comment">// true (2004 is a leap year)</span>
  <span class="type"><a href="qdate.html#QDate">QDate</a></span><span class="operator">::</span>isValid(<span class="number">2000</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">29</span>);  <span class="comment">// true (2000 is a leap year)</span>
  <span class="type"><a href="qdate.html#QDate">QDate</a></span><span class="operator">::</span>isValid(<span class="number">2006</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">29</span>);  <span class="comment">// false (2006 is not a leap year)</span>
  <span class="type"><a href="qdate.html#QDate">QDate</a></span><span class="operator">::</span>isValid(<span class="number">2100</span><span class="operator">,</span> <span class="number">2</span><span class="operator">,</span> <span class="number">29</span>);  <span class="comment">// false (2100 is not a leap year)</span>
  <span class="type"><a href="qdate.html#QDate">QDate</a></span><span class="operator">::</span>isValid(<span class="number">1202</span><span class="operator">,</span> <span class="number">6</span><span class="operator">,</span> <span class="number">6</span>);   <span class="comment">// true (even though 1202 is pre-Gregorian)</span>

</pre>
<p><b>See also </b><a href="qdate.html#isNull">isNull</a>() and <a href="qdate.html#setDate">setDate</a>().</p>
<!-- @@@isValid -->
<!-- $$$longDayName[overload1]$$$longDayNameintMonthNameType -->
<h3 class="fn" id="longDayName"><a name="longDayName"></a><code>[static] </code><span class="type"><a href="qstring.html">QString</a></span> QDate::<span class="name">longDayName</span>(<span class="type">int</span> <i>weekday</i>, <span class="type"><a href="qdate.html#MonthNameType-enum">MonthNameType</a></span> <i>type</i> = DateFormat)</h3>
<p>Returns the long name of the <i>weekday</i> for the representation specified by <i>type</i>.</p>
<p>The days are enumerated using the following convention:</p>
<ul>
<li>1 = &quot;Monday&quot;</li>
<li>2 = &quot;Tuesday&quot;</li>
<li>3 = &quot;Wednesday&quot;</li>
<li>4 = &quot;Thursday&quot;</li>
<li>5 = &quot;Friday&quot;</li>
<li>6 = &quot;Saturday&quot;</li>
<li>7 = &quot;Sunday&quot;</li>
</ul>
<p>The day names will be localized according to the system's locale settings, i.e&#x2e; using <a href="qlocale.html#system">QLocale::system</a>().</p>
<p>Returns an empty string if the date is invalid.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><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>
<!-- @@@longDayName -->
<!-- $$$longMonthName[overload1]$$$longMonthNameintMonthNameType -->
<h3 class="fn" id="longMonthName"><a name="longMonthName"></a><code>[static] </code><span class="type"><a href="qstring.html">QString</a></span> QDate::<span class="name">longMonthName</span>(<span class="type">int</span> <i>month</i>, <span class="type"><a href="qdate.html#MonthNameType-enum">MonthNameType</a></span> <i>type</i> = DateFormat)</h3>
<p>Returns the long name of the <i>month</i> for the representation specified by <i>type</i>.</p>
<p>The months are enumerated using the following convention:</p>
<ul>
<li>1 = &quot;January&quot;</li>
<li>2 = &quot;February&quot;</li>
<li>3 = &quot;March&quot;</li>
<li>4 = &quot;April&quot;</li>
<li>5 = &quot;May&quot;</li>
<li>6 = &quot;June&quot;</li>
<li>7 = &quot;July&quot;</li>
<li>8 = &quot;August&quot;</li>
<li>9 = &quot;September&quot;</li>
<li>10 = &quot;October&quot;</li>
<li>11 = &quot;November&quot;</li>
<li>12 = &quot;December&quot;</li>
</ul>
<p>The month names will be localized according to the system's locale settings, i.e&#x2e; using <a href="qlocale.html#system">QLocale::system</a>().</p>
<p>Returns an empty string if the date is invalid.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><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>
<!-- @@@longMonthName -->
<!-- $$$month[overload1]$$$month -->
<h3 class="fn" id="month"><a name="month"></a><span class="type">int</span> QDate::<span class="name">month</span>() const</h3>
<p>Returns the number corresponding to the month of this date, using the following convention:</p>
<ul>
<li>1 = &quot;January&quot;</li>
<li>2 = &quot;February&quot;</li>
<li>3 = &quot;March&quot;</li>
<li>4 = &quot;April&quot;</li>
<li>5 = &quot;May&quot;</li>
<li>6 = &quot;June&quot;</li>
<li>7 = &quot;July&quot;</li>
<li>8 = &quot;August&quot;</li>
<li>9 = &quot;September&quot;</li>
<li>10 = &quot;October&quot;</li>
<li>11 = &quot;November&quot;</li>
<li>12 = &quot;December&quot;</li>
</ul>
<p>Returns 0 if the date is invalid.</p>
<p><b>See also </b><a href="qdate.html#year">year</a>() and <a href="qdate.html#day">day</a>().</p>
<!-- @@@month -->
<!-- $$$setDate[overload1]$$$setDateintintint -->
<h3 class="fn" id="setDate"><a name="setDate"></a><span class="type">bool</span> QDate::<span class="name">setDate</span>(<span class="type">int</span> <i>year</i>, <span class="type">int</span> <i>month</i>, <span class="type">int</span> <i>day</i>)</h3>
<p>Sets the date's <i>year</i>, <i>month</i>, and <i>day</i>. Returns <code>true</code> if the date is valid; otherwise returns <code>false</code>.</p>
<p>If the specified date is invalid, the <a href="qdate.html">QDate</a> object is set to be invalid.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qdate.html#isValid">isValid</a>().</p>
<!-- @@@setDate -->
<!-- $$$shortDayName[overload1]$$$shortDayNameintMonthNameType -->
<h3 class="fn" id="shortDayName"><a name="shortDayName"></a><code>[static] </code><span class="type"><a href="qstring.html">QString</a></span> QDate::<span class="name">shortDayName</span>(<span class="type">int</span> <i>weekday</i>, <span class="type"><a href="qdate.html#MonthNameType-enum">MonthNameType</a></span> <i>type</i> = DateFormat)</h3>
<p>Returns the short name of the <i>weekday</i> for the representation specified by <i>type</i>.</p>
<p>The days are enumerated using the following convention:</p>
<ul>
<li>1 = &quot;Mon&quot;</li>
<li>2 = &quot;Tue&quot;</li>
<li>3 = &quot;Wed&quot;</li>
<li>4 = &quot;Thu&quot;</li>
<li>5 = &quot;Fri&quot;</li>
<li>6 = &quot;Sat&quot;</li>
<li>7 = &quot;Sun&quot;</li>
</ul>
<p>The day names will be localized according to the system's locale settings, i.e&#x2e; using <a href="qlocale.html#system">QLocale::system</a>().</p>
<p>Returns an empty string if the date is invalid.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><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>
<!-- @@@shortDayName -->
<!-- $$$shortMonthName[overload1]$$$shortMonthNameintMonthNameType -->
<h3 class="fn" id="shortMonthName"><a name="shortMonthName"></a><code>[static] </code><span class="type"><a href="qstring.html">QString</a></span> QDate::<span class="name">shortMonthName</span>(<span class="type">int</span> <i>month</i>, <span class="type"><a href="qdate.html#MonthNameType-enum">MonthNameType</a></span> <i>type</i> = DateFormat)</h3>
<p>Returns the short name of the <i>month</i> for the representation specified by <i>type</i>.</p>
<p>The months are enumerated using the following convention:</p>
<ul>
<li>1 = &quot;Jan&quot;</li>
<li>2 = &quot;Feb&quot;</li>
<li>3 = &quot;Mar&quot;</li>
<li>4 = &quot;Apr&quot;</li>
<li>5 = &quot;May&quot;</li>
<li>6 = &quot;Jun&quot;</li>
<li>7 = &quot;Jul&quot;</li>
<li>8 = &quot;Aug&quot;</li>
<li>9 = &quot;Sep&quot;</li>
<li>10 = &quot;Oct&quot;</li>
<li>11 = &quot;Nov&quot;</li>
<li>12 = &quot;Dec&quot;</li>
</ul>
<p>The month names will be localized according to the system's locale settings, i.e&#x2e; using <a href="qlocale.html#system">QLocale::system</a>().</p>
<p>Returns an empty string if the date is invalid.</p>
<p>This function was introduced in  Qt 4.5.</p>
<p><b>See also </b><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>
<!-- @@@shortMonthName -->
<!-- $$$toJulianDay[overload1]$$$toJulianDay -->
<h3 class="fn" id="toJulianDay"><a name="toJulianDay"></a><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QDate::<span class="name">toJulianDay</span>() const</h3>
<p>Converts the date to a Julian day.</p>
<p><b>See also </b><a href="qdate.html#fromJulianDay">fromJulianDay</a>().</p>
<!-- @@@toJulianDay -->
<!-- $$$toString[overload1]$$$toStringconstQString& -->
<h3 class="fn" id="toString"><a name="toString"></a><span class="type"><a href="qstring.html">QString</a></span> QDate::<span class="name">toString</span>(const <span class="type"><a href="qstring.html">QString</a></span> &amp;<i>format</i>) const</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>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >Expression</th><th >Output</th></tr></thead>
<tr valign="top" class="odd"><td >d</td><td >the day as number without a leading zero (1 to 31)</td></tr>
<tr valign="top" class="even"><td >dd</td><td >the day as number with a leading zero (01 to 31)</td></tr>
<tr valign="top" class="odd"><td >ddd</td><td >the abbreviated localized day name (e.g&#x2e; 'Mon' to 'Sun'). Uses the system locale to localize the name, i.e&#x2e; <a href="qlocale.html#system">QLocale::system</a>().</td></tr>
<tr valign="top" class="even"><td >dddd</td><td >the long localized day name (e.g&#x2e; 'Monday' to 'Sunday'). Uses the system locale to localize the name, i.e&#x2e; <a href="qlocale.html#system">QLocale::system</a>().</td></tr>
<tr valign="top" class="odd"><td >M</td><td >the month as number without a leading zero (1 to 12)</td></tr>
<tr valign="top" class="even"><td >MM</td><td >the month as number with a leading zero (01 to 12)</td></tr>
<tr valign="top" class="odd"><td >MMM</td><td >the abbreviated localized month name (e.g&#x2e; 'Jan' to 'Dec'). Uses the system locale to localize the name, i.e&#x2e; <a href="qlocale.html#system">QLocale::system</a>().</td></tr>
<tr valign="top" class="even"><td >MMMM</td><td >the long localized month name (e.g&#x2e; 'January' to 'December'). Uses the system locale to localize the name, i.e&#x2e; <a href="qlocale.html#system">QLocale::system</a>().</td></tr>
<tr valign="top" class="odd"><td >yy</td><td >the year as two digit number (00 to 99)</td></tr>
<tr valign="top" class="even"><td >yyyy</td><td >the year as four digit number. If the year is negative, a minus sign is prepended in addition.</td></tr>
</table></div>
<p>All other input characters will be ignored. Any sequence of characters that are enclosed in single quotes will be treated as text and not be used as an expression. Two consecutive single quotes (&quot;''&quot;) are replaced by a singlequote in the output. Formats without separators (e.g&#x2e; &quot;ddMM&quot;) are currently not supported.</p>
<p>Example format strings (assuming that the <a href="qdate.html">QDate</a> is the 20 July 1969):</p>
<div class="table"><table class="generic">
 <thead><tr class="qt-style"><th >Format</th><th >Result</th></tr></thead>
<tr valign="top" class="odd"><td >dd.MM.yyyy</td><td >20.07.1969</td></tr>
<tr valign="top" class="even"><td >ddd MMMM d yy</td><td >Sun July 20 69</td></tr>
<tr valign="top" class="odd"><td >'The day is' dddd</td><td >The day is Sunday</td></tr>
</table></div>
<p>If the datetime is invalid, an empty string will be returned.</p>
<p><b>See also </b><a href="qdate.html#fromString">fromString</a>(), <a href="qdatetime.html#toString">QDateTime::toString</a>(), <a href="qtime.html#toString">QTime::toString</a>(), and <a href="qlocale.html#toString">QLocale::toString</a>().</p>
<!-- @@@toString -->
<!-- $$$toString$$$toStringQt::DateFormat -->
<h3 class="fn" id="toString-1"><a name="toString-1"></a><span class="type"><a href="qstring.html">QString</a></span> QDate::<span class="name">toString</span>(<span class="type"><a href="qt.html#DateFormat-enum">Qt::DateFormat</a></span> <i>format</i> = Qt::TextDate) const</h3>
<p>This is an overloaded function.</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 using the system locale, i.e&#x2e; <a href="qlocale.html#system">QLocale::system</a>(). An example of this formatting is &quot;Sat May 20 1995&quot;.</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::SystemLocaleShortDate</a> or <a href="qt.html#DateFormat-enum">Qt::SystemLocaleLongDate</a>, the string format depends on the locale settings of the system. Identical to calling <a href="qlocale.html#system">QLocale::system</a>().<a href="qdate.html#toString">toString</a>(date, <a href="qlocale.html#FormatType-enum">QLocale::ShortFormat</a>) or <a href="qlocale.html#system">QLocale::system</a>().<a href="qdate.html#toString">toString</a>(date, <a href="qlocale.html#FormatType-enum">QLocale::LongFormat</a>).</p>
<p>If the <i>format</i> is <a href="qt.html#DateFormat-enum">Qt::DefaultLocaleShortDate</a> or <a href="qt.html#DateFormat-enum">Qt::DefaultLocaleLongDate</a>, the string format depends on the default application locale. This is the locale set with <a href="qlocale.html#setDefault">QLocale::setDefault</a>(), or the system locale if no default locale has been set. Identical to calling <a href="qlocale.html#toString">QLocale().toString(date, QLocale::ShortFormat) </a> or <a href="qlocale.html#toString">QLocale().toString(date, QLocale::LongFormat)</a>.</p>
<p>If the <i>format</i> is <a href="qt.html#DateFormat-enum">Qt::RFC2822Date</a>, the string is formatted in an RFC 2822 compatible way. An example of this formatting is &quot;20 May 1995&quot;.</p>
<p>If the date is invalid, an empty string will be returned.</p>
<p><b>Warning:</b> The <a href="qt.html#DateFormat-enum">Qt::ISODate</a> format is only valid for years in the range 0 to 9999. This restriction may apply to locale-aware formats as well, depending on the locale settings.</p>
<p><b>See also </b><a href="qdate.html#fromString">fromString</a>(), <a href="qdate.html#shortDayName">shortDayName</a>(), <a href="qdate.html#shortMonthName">shortMonthName</a>(), and <a href="qlocale.html#toString">QLocale::toString</a>().</p>
<!-- @@@toString -->
<!-- $$$weekNumber[overload1]$$$weekNumberint* -->
<h3 class="fn" id="weekNumber"><a name="weekNumber"></a><span class="type">int</span> QDate::<span class="name">weekNumber</span>(<span class="type">int</span> *<i>yearNumber</i> = Q_NULLPTR) const</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 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>
<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><b>See also </b><a href="qdate.html#isValid">isValid</a>().</p>
<!-- @@@weekNumber -->
<!-- $$$year[overload1]$$$year -->
<h3 class="fn" id="year"><a name="year"></a><span class="type">int</span> QDate::<span class="name">year</span>() const</h3>
<p>Returns the year of this date. Negative numbers indicate years before 1 CE, such that year -44 is 44 BCE.</p>
<p>Returns 0 if the date is invalid.</p>
<p><b>See also </b><a href="qdate.html#month">month</a>() and <a href="qdate.html#day">day</a>().</p>
<!-- @@@year -->
<!-- $$$operator!=[overload1]$$$operator!=constQDate& -->
<h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> QDate::<span class="name">operator!=</span>(const <span class="type"><a href="qdate.html#QDate">QDate</a></span> &amp;<i>d</i>) const</h3>
<p>Returns <code>true</code> if this date is different from <i>d</i>; otherwise returns <code>false</code>.</p>
<!-- @@@operator!= -->
<!-- $$$operator<[overload1]$$$operator<constQDate& -->
<h3 class="fn" id="operator-lt"><a name="operator-lt"></a><span class="type">bool</span> QDate::<span class="name">operator&lt;</span>(const <span class="type"><a href="qdate.html#QDate">QDate</a></span> &amp;<i>d</i>) const</h3>
<p>Returns <code>true</code> if this date is earlier than <i>d</i>; otherwise returns false.</p>
<!-- @@@operator< -->
<!-- $$$operator<=[overload1]$$$operator<=constQDate& -->
<h3 class="fn" id="operator-lt-eq"><a name="operator-lt-eq"></a><span class="type">bool</span> QDate::<span class="name">operator&lt;=</span>(const <span class="type"><a href="qdate.html#QDate">QDate</a></span> &amp;<i>d</i>) const</h3>
<p>Returns <code>true</code> if this date is earlier than or equal to <i>d</i>; otherwise returns <code>false</code>.</p>
<!-- @@@operator<= -->
<!-- $$$operator==[overload1]$$$operator==constQDate& -->
<h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> QDate::<span class="name">operator==</span>(const <span class="type"><a href="qdate.html#QDate">QDate</a></span> &amp;<i>d</i>) const</h3>
<p>Returns <code>true</code> if this date is equal to <i>d</i>; otherwise returns false.</p>
<!-- @@@operator== -->
<!-- $$$operator>[overload1]$$$operator>constQDate& -->
<h3 class="fn" id="operator-gt"><a name="operator-gt"></a><span class="type">bool</span> QDate::<span class="name">operator&gt;</span>(const <span class="type"><a href="qdate.html#QDate">QDate</a></span> &amp;<i>d</i>) const</h3>
<p>Returns <code>true</code> if this date is later than <i>d</i>; otherwise returns false.</p>
<!-- @@@operator> -->
<!-- $$$operator>=[overload1]$$$operator>=constQDate& -->
<h3 class="fn" id="operator-gt-eq"><a name="operator-gt-eq"></a><span class="type">bool</span> QDate::<span class="name">operator&gt;=</span>(const <span class="type"><a href="qdate.html#QDate">QDate</a></span> &amp;<i>d</i>) const</h3>
<p>Returns <code>true</code> if this date is later than or equal to <i>d</i>; otherwise returns <code>false</code>.</p>
<!-- @@@operator>= -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$operator<<[overload1]$$$operator<<QDataStream&constQDate& -->
<h3 class="fn" id="operator-lt-lt"><a name="operator-lt-lt"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp;<span class="name">operator&lt;&lt;</span>(<span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp;<i>out</i>, const <span class="type"><a href="qdate.html#QDate">QDate</a></span> &amp;<i>date</i>)</h3>
<p>Writes the <i>date</i> to stream <i>out</i>.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator<< -->
<!-- $$$operator>>[overload1]$$$operator>>QDataStream&QDate& -->
<h3 class="fn" id="operator-gt-gt"><a name="operator-gt-gt"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp;<span class="name">operator&gt;&gt;</span>(<span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp;<i>in</i>, <span class="type"><a href="qdate.html#QDate">QDate</a></span> &amp;<i>date</i>)</h3>
<p>Reads a date from stream <i>in</i> into the <i>date</i>.</p>
<p><b>See also </b><a href="datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator>> -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>