
The isLeapYear() function indicates whether a date is in a leap year.

The daysInMonth() and daysInYear() functions return how many days there are in this date's month and year, respectively. The daysTo() function returns the number of days between two dates. Similarly you can use addMonths() and addYears(). You can increment (or decrement) a date by a given number of days using addDays().
SETDATE FULL
QDate provides a full set of operators to compare two QDate objects where smaller means earlier, and larger means later. QLocale can map the day numbers to names, QCalendar can map month numbers to names. The same information is provided in textual format by toString(). When more than one of these values is needed, it is more efficient to call QCalendar::partsFromDate(), to save repeating (potentially expensive) calendrical calculations.Īlso, dayOfWeek() and dayOfYear() functions are provided. The year(), month(), and day() functions provide access to the year, month, and day numbers. The fromString() function returns a QDate given a string and a date format which is used to interpret the date within the string. An explicit date can also be set using setDate(). The static function currentDate() creates a QDate object containing the date read from the system clock. Note that QDate interprets year numbers less than 100 as presented, i.e., as years 1 through 99, without adding any offset.

It can report the year, month and day of the month that represent the day with respect to the proleptic Gregorian calendar or any calendar supplied as a QCalendar object.Ī QDate object is typically created by giving the year, month, and day numbers explicitly. WeekNumber(int * yearNumber = nullptr) constĪ QDate object represents a particular day, regardless of calendar, locale or other settings used when creating it or supplied by the system. ToString(QStringView format, QCalendar cal) const ToString(const QString & format, QCalendar cal) const ToString(Qt::DateFormat format = Qt::TextDate) const StartOfDay(Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0) const SetDate(int year, int month, int day, QCalendar cal)

GetDate(int * year, int * month, int * day) const AddMonths(int nmonths, QCalendar cal) constĪddYears(int nyears, QCalendar cal) constĮndOfDay(Qt::TimeSpec spec = Qt::LocalTime, int offsetSeconds = 0) const
