📄 qdate.3qt
字号:
'\" t.TH QDate 3qt "9 December 2002" "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.SH SYNOPSISAll the functions in this class are reentrant when Qt is built with thread support.</p>.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 "int \fBweekNumber\fR ( int * yearNumber = 0 ) const".br.ti -1c.BI "QString \fBtoString\fR ( Qt::DateFormat f = Qt::TextDate ) const".br.ti -1c.BI "QString \fBtoString\fR ( const QString & format ) const".br.ti -1c.BI "bool \fBsetYMD\fR ( int y, int m, int d )".br.ti -1c.BI "QDate \fBaddDays\fR ( int ndays ) const".br.ti -1c.BI "QDate \fBaddMonths\fR ( int nmonths ) const".br.ti -1c.BI "QDate \fBaddYears\fR ( int nyears ) const".br.ti -1c.BI "int \fBdaysTo\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.ti -1c.BI "bool \fBoperator>=\fR ( const QDate & d ) const".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "QString monthName ( int month ) \fI(obsolete)\fR".br.ti -1c.BI "QString dayName ( int weekday ) \fI(obsolete)\fR".br.ti -1c.BI "QString \fBshortMonthName\fR ( int month )".br.ti -1c.BI "QString \fBshortDayName\fR ( int weekday )".br.ti -1c.BI "QString \fBlongMonthName\fR ( int month )".br.ti -1c.BI "QString \fBlongDayName\fR ( int weekday )".br.ti -1c.BI "QDate \fBcurrentDate\fR ()".br.ti -1c.BI "QDate \fBcurrentDate\fR ( Qt::TimeSpec ts )".br.ti -1c.BI "QDate \fBfromString\fR ( const QString & s, Qt::DateFormat f = Qt::TextDate )".br.ti -1c.BI "bool \fBisValid\fR ( int y, int m, int d )".br.ti -1c.BI "bool \fBleapYear\fR ( int y )".br.in -1c.SH RELATED FUNCTION DOCUMENTATION.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 dates, e.g. by adding a number of days or months or years..PPA QDate object is typically created either by giving the year, month and day numbers explicitly, or by using the static function currentDate(), which creates a QDate object containing the system clock's date. An explicit date can also be set using setYMD(). The fromString() function returns a QDate given a string and a date format which is used to interpret the date within the string..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(), shortDayName(), longDayName(), shortMonthName() and longMonthName() functions..PPQDate provides a full set of operators to compare two QDate objects where smaller means earlier and larger means later..PPYou can increment (or decrement) a date by a given number of days using addDays(). Similarly you can use addMonths() and addYears(). The daysTo() function returns the number of days between two dates..PPThe daysInMonth() and daysInYear() functions return how many days there are in this date's month and year, respectively. The leapYear() function indicates whether this date is in a leap year..PPNote that QDate should not be used for date calculations for dates prior to the introduction of the Gregorian calendar. This calendar was adopted by England from the 14<sup><small>th</small></sup> September 1752 (hence this is the earliest valid QDate), and subsequently by most other Western countries, until 1923..PPThe end of time is reached around the year 8000, by which time we expect Qt to be obsolete..PPSee also QTime, QDateTime, QDateEdit, QDateTimeEdit, and Time and Date..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 year \fIy\fR, month \fIm\fR and day \fId\fR..PP\fIy\fR must be in the range 1752..8000, \fIm\fR must be in the range 1..12, and \fId\fR must be in the range 1..31..PP\fBWarning:\fR 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 addMonths(), addYears(), and daysTo()..SH "QDate QDate::addMonths ( int nmonths ) const"Returns a QDate object containing a date \fInmonths\fR later than the date of this object (or earlier if \fInmonths\fR is negative)..PPSee also addDays() and addYears()..SH "QDate QDate::addYears ( int nyears ) const"Returns a QDate object containing a date \fInyears\fR later than the date of this object (or earlier if \fInyears\fR is negative)..PPSee also addDays() and addMonths()..SH "QDate QDate::currentDate ( Qt::TimeSpec ts )\fC [static]\fR"Returns the current date, as reported by the system clock, for the TimeSpec \fIts\fR. The default TimeSpec is LocalTime..PPSee also QTime::currentTime(), QDateTime::currentDateTime(), and Qt::TimeSpec..PPExample: dclock/dclock.cpp..SH "QDate QDate::currentDate ()\fC [static]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns 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()..PPExample: dclock/dclock.cpp..SH "QString QDate::dayName ( int weekday )\fC [static]\fR"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPUse shortDayName() instead..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.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -