📄 qdate.3qt
字号:
'\" t.TH QDate 3qt "24 January 2005" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQDate \- Date functions.br.PP\fC#include <qdatetime.h>\fR.PP.SS "Public Members".in +1c.ti -1c.BI "\fBQDate\fR () ".br.ti -1c.BI "\fBQDate\fR ( int " "y" ", int " "m" ", int d ) ".br.ti -1c.BI "bool \fBisNull\fR () const".br.ti -1c.BI "bool \fBisValid\fR () const".br.ti -1c.BI "int \fByear\fR () const".br.ti -1c.BI "int \fBmonth\fR () const".br.ti -1c.BI "int \fBday\fR () const".br.ti -1c.BI "int \fBdayOfWeek\fR () const".br.ti -1c.BI "int \fBdayOfYear\fR () const".br.ti -1c.BI "int \fBdaysInMonth\fR () const".br.ti -1c.BI "int \fBdaysInYear\fR () const".br.ti -1c.BI "virtual QString \fBmonthName\fR ( int month ) const".br.ti -1c.BI "virtual QString \fBdayName\fR ( int weekday ) const".br.ti -1c.BI "QString \fBtoString\fR () const".br.ti -1c.BI "bool \fBsetYMD\fR ( int " "y" ", int " "m" ", int d ) ".br.ti -1c.BI "QDate \fBaddDays\fR ( int days ) const".br.ti -1c.BI "int \fBdaysTo\fR ( const QDate & ) const".br.ti -1c.BI "bool \fBoperator==\fR ( const QDate & d ) const".br.ti -1c.BI "bool \fBoperator!=\fR ( const QDate & d ) const".br.ti -1c.BI "bool \fBoperator<\fR ( const QDate & d ) const".br.ti -1c.BI "bool \fBoperator<=\fR ( const QDate & d ) const".br.ti -1c.BI "bool \fBoperator>\fR ( const QDate & d ) const".br.ti -1c.BI "bool \fBoperator>=\fR ( const QDate & d ) const".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "QDate \fBcurrentDate\fR () ".br.ti -1c.BI "bool \fBisValid\fR ( int " "y" ", int " "m" ", int d ) ".br.ti -1c.BI "bool \fBleapYear\fR ( int year ) ".br.in -1c.SS "Static Protected Members".in +1c.ti -1c.BI "uint \fBgreg2jul\fR ( int " "y" ", int " "m" ", int d ) (internal)".br.ti -1c.BI "void \fBjul2greg\fR ( uint " "jd" ", int & " "y" ", int & " "m" ", int & d ) (internal)".br.in -1c.SH RELATED FUNCTION DOCUMENTATION(Note that these are not member functions.).in +1c.ti -1c.BI "QDataStream & \fBoperator<<\fR (QDataStream & " "s" ", const QDate & " "d" ")".br.ti -1c.BI "QDataStream & \fBoperator>>\fR (QDataStream & " "s" ", QDate & " "d" ")".br.in -1c.SH DESCRIPTIONThe QDate class provides date functions..PPA QDate object contains a calendar date, i.e. year, month, and day numbers in the modern western (Gregorian) calendar. It can read the current date from the system clock. It provides functions for comparing dates and for manipulating a date by adding a number of days..PPA QDate object is typically created either by giving the year, month and day numbers explicitly, or by using the static function currentDate(), which makes a QDate object which contains the system's clock date. An explicit date can also be set using setYMD()..PPThe year(), month(), and day() functions provide access to the year, month, and day numbers. Also, dayOfWeek() and dayOfYear() functions are provided. The same information is provided in textual format by the toString(), dayName(), and monthName() functions..PPQDate provides a full set of operators to compare two QDate objects. A date is considered smaller than another if it is earlier than the other..PPThe date a given number of days later than a given date can be found using the addDays() function. Correspondingly, the number of days between two dates can be found using the daysTo() function..PPThe daysInMonth() and daysInYear() functions tell how many days there are in this date's month and year, respectively. The isLeapYear() function tells whether this date is in a leap year..PPNote that QDate may not be used for date calculations for dates in the remote past, i.e. prior to the introduction of the Gregorian calendar. This calendar was adopted by England Sep. 14. 1752 (hence this is the earliest valid QDate), and subsequently by most other western countries, until 1923..PPThe end of time is reached around 8000AD, by which time we expect Qt to be obsolete..PPSee also QTime and QDateTime..SH MEMBER FUNCTION DOCUMENTATION.SH "QDate::QDate ()"Constructs a null date. Null dates are invalid..PPSee also isNull() and isValid()..SH "QDate::QDate ( int y, int m, int d )"Constructs a date with the year \fIy,\fR month \fIm\fR and day \fId.\fR.PP\fIy\fR must be in the range 1752-ca. 8000, \fIm\fR must be in the range 1-12, and \fId\fR must be in the range 1-31. Exception: if \fIy\fR is in the range 0-99, it is interpreted as 1900-1999..PPSee also isValid()..SH "QDate QDate::addDays ( int ndays ) const"Returns a QDate object containing a date \fIndays\fR later than the date of this object (or earlier if \fIndays\fR is negative)..PPSee also daysTo()..SH "QDate QDate::currentDate () \fC[static]\fR"Returns the current date, as reported by the system clock..PPSee also QTime::currentTime() and QDateTime::currentDateTime()..SH "int QDate::day () const"Returns the day of the month (1..31) of this date..PPSee also year(), month() and dayOfWeek()..SH "QString QDate::dayName ( int weekday ) const \fC[virtual]\fR"Returns the name of the \fIweekday.\fR.PPWeekday 1 == "Mon", day 2 == "Tue" etc..PPSee also toString() and monthName()..SH "int QDate::dayOfWeek () const"Returns the weekday (Monday=1 .. Sunday=7) for this date..PPSee also day() and dayOfYear()..SH "int QDate::dayOfYear () const"Returns the day of the year (1..365) for this date..PPSee also day() and dayOfWeek()..SH "int QDate::daysInMonth () const"Returns the number of days in the month (28..31) for this date..PPSee also day() and daysInYear()..SH "int QDate::daysInYear () const"Returns the number of days in the year (365 or 366) for this date..PPSee also day() and daysInMonth()..SH "int QDate::daysTo ( const QDate & d ) const"Returns the number of days from this date to \fId\fR (which is negative if \fId\fR is earlier than this date)..PPExample:.PP.nf.br QDate d1( 1995, 5, 17 ); // May 17th 1995.br QDate d2( 1995, 5, 20 ); // May 20th 1995.br d1.daysTo( d2 ); // returns 3.br d2.daysTo( d1 ); // returns -3.fi.PPSee also addDays()..SH "bool QDate::isNull () const"Returns TRUE if the date is null. A null date is invalid..PPSee also isValid()..SH "bool QDate::isValid () const"Returns TRUE if this date is valid..PPSee also isNull()..SH "bool QDate::isValid ( int y, int m, int d ) \fC[static]\fR"Returns TRUE if the specified date (year \fIy,\fR month \fIm\fR and day \fId)\fR is valid..PPExample:.PP.nf.br QDate::isValid( 2002, 5, 17 ); // TRUE; May 17th 2002 is OK..br QDate::isValid( 2002, 2, 30 ); // FALSE; Feb 30th does not exist.br QDate::isValid( 2004, 2, 29 ); // TRUE; 2004 is a leap year.br QDate::isValid( 1202, 6, 6 ); // FALSE; 1202 is pre-Gregorian.fi.PPNote that a \fIy\fR value in the range 00-99 is interpreted as 1900-1999..PPSee also isNull() and setYMD()..SH "bool QDate::leapYear ( int y ) \fC[static]\fR"Returns TRUE if the specified year \fIy\fR is a leap year..SH "int QDate::month () const"Returns the month (January=1 .. December=12) of this date..PPSee also year() and day()..SH "QString QDate::monthName ( int month ) const \fC[virtual]\fR"Returns the name of the \fImonth.\fR.PPMonth 1 == "Jan", month 2 == "Feb" etc..PPSee also toString() and dayName()..SH "bool QDate::operator!= ( const QDate & d ) const"Returns TRUE if this date is different from \fId,\fR or FALSE if they are equal..SH "bool QDate::operator< ( const QDate & d ) const"Returns TRUE if this date is earlier than \fId,\fR otherwise FALSE..SH "bool QDate::operator<= ( const QDate & d ) const"Returns TRUE if this date is earlier than or equal to \fId,\fR otherwise FALSE..SH "bool QDate::operator== ( const QDate & d ) const"Returns TRUE if this date is equal to \fId,\fR or FALSE if they are different..SH "bool QDate::operator> ( const QDate & d ) const"Returns TRUE if this date is later than \fId,\fR otherwise FALSE..SH "bool QDate::operator>= ( const QDate & d ) const"Returns TRUE if this date is later than or equal to \fId,\fR otherwise FALSE..SH "bool QDate::setYMD ( int y, int m, int d )"Sets the year \fIy,\fR month \fIm\fR and day \fId.\fR.PP\fIy\fR must be in the range 1752-ca. 8000, \fIm\fR must be in the range 1-12, and \fId\fR must be in the range 1-31. Exception: if \fIy\fR is in the range 0-99, it is interpreted as 1900-1999..PPReturns TRUE if the date is valid, otherwise FALSE..SH "QString QDate::toString () const"Returns the date as a string..PPThe string format is "Sat May 20 1995". This function uses the dayName() and monthName() functions to generate the string..PPSee also dayName() and monthName()..SH "int QDate::year () const"Returns the year (>= 1752) of this date..PPSee also month() and day()..SH "uint QDate::greg2jul ( int y, int m, int d ) \fC[static protected]\fR"For internal use only..SH "void QDate::jul2greg ( uint jd, int & y, int & m, int & d ) \fC[static protected]\fR"For internal use only..SH RELATED FUNCTION DOCUMENTATION.SH "QDataStream & operator<< (QDataStream & s, const QDate & d)"Writes the date to the stream..PPSee also Format of the QDataStream operators.SH "QDataStream & operator>> (QDataStream & s, QDate & d)"Reads a date from the stream..PPSee also Format of the QDataStream operators.SH "SEE ALSO".BR http://doc.trolltech.com/qdate.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qdate.3qt) and the Qtversion (2.3.10).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -