- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Friends

# QDate Class Reference

Search for all occurrences

## Detailed Description

Definition at line 55 of file qdatetime.h.

`#include <qdatetime.h>`

List of all members.

## Public Types
enum | MonthNameType { DateFormat = 0, StandaloneFormat }
## Public Member Functions
| QDate ()
| QDate (int y, int m, int d)
bool | isNull () const
bool | isValid () const
int | year () const
int | month () const
int | day () const
int | dayOfWeek () const
int | dayOfYear () const
int | daysInMonth () const
int | daysInYear () const
int | weekNumber (int *yearNum=0) const
QString | toString (Qt::DateFormat f=Qt::TextDate) const
QString | toString (const QString &format) const
bool | setYMD (int y, int m, int d)
bool | setDate (int year, int month, int day)
void | getDate (int *year, int *month, int *day)
QDate | addDays (int days) const
QDate | addMonths (int months) const
QDate | addYears (int years) const
int | daysTo (const QDate &) const
bool | operator== (const QDate &other) const
bool | operator!= (const QDate &other) const
bool | operator< (const QDate &other) const
bool | operator<= (const QDate &other) const
bool | operator> (const QDate &other) const
bool | operator>= (const QDate &other) const
int | toJulianDay () const
## Static Public Member Functions
static QString | shortMonthName (int month)
static QString | shortMonthName (int month, MonthNameType type)
static QString | shortDayName (int weekday)
static QString | shortDayName (int weekday, MonthNameType type)
static QString | longMonthName (int month)
static QString | longMonthName (int month, MonthNameType type)
static QString | longDayName (int weekday)
static QString | longDayName (int weekday, MonthNameType type)
static QDate | currentDate ()
static QDate | fromString (const QString &s, Qt::DateFormat f=Qt::TextDate)
static QDate | fromString (const QString &s, const QString &format)
static bool | isValid (int y, int m, int d)
static bool | isLeapYear (int year)
static uint | gregorianToJulian (int y, int m, int d)
static void | julianToGregorian (uint jd, int &y, int &m, int &d)
static QDate | fromJulianDay (int jd)
## Friends
class | QDateTime
class | QDateTimePrivate
Q_CORE_EXPORT QDataStream & | operator<< (QDataStream &, const QDate &)
Q_CORE_EXPORT QDataStream & | operator>> (QDataStream &, QDate &)

## Member Enumeration Documentation

enum MonthNameType

Search for all occurrences

Enumerator:

  DateFormat | Search for all occurrences
  StandaloneFormat | Search for all occurrences

Definition at line 58 of file qdatetime.h.

                           {
            DateFormat = 0,
            StandaloneFormat
        };

## Constructor & Destructor Documentation

QDate | ( |  | ) | `[inline]`

Definition at line 63 of file qdatetime.h.

    { jd = 0; }

QDate | ( | int | y,
|  | int | m,
|  | int | d
| ) |  |

## Member Function Documentation

bool isNull | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 66 of file qdatetime.h.

    { return jd == 0; }

bool isValid | ( |  | ) | const

Search for all occurrences

int year | ( |  | ) | const

Search for all occurrences

int month | ( |  | ) | const

Search for all occurrences

int day | ( |  | ) | const

Search for all occurrences

int dayOfWeek | ( |  | ) | const

Search for all occurrences

int dayOfYear | ( |  | ) | const

Search for all occurrences

int daysInMonth | ( |  | ) | const

Search for all occurrences

int daysInYear | ( |  | ) | const

Search for all occurrences

int weekNumber | ( | int * | yearNum = `0` | ) | const

Search for all occurrences

static QString shortMonthName | ( | int | month | ) | `[static]`

Search for all occurrences

static QString shortMonthName | ( | int | month,
|  | MonthNameType | type
| ) |  | `[static]`

Search for all occurrences

static QString shortDayName | ( | int | weekday | ) | `[static]`

Search for all occurrences

static QString shortDayName | ( | int | weekday,
|  | MonthNameType | type
| ) |  | `[static]`

Search for all occurrences

static QString longMonthName | ( | int | month | ) | `[static]`

Search for all occurrences

static QString longMonthName | ( | int | month,
|  | MonthNameType | type
| ) |  | `[static]`

Search for all occurrences

static QString longDayName | ( | int | weekday | ) | `[static]`

Search for all occurrences

static QString longDayName | ( | int | weekday,
|  | MonthNameType | type
| ) |  | `[static]`

Search for all occurrences

QString toString | ( | Qt::DateFormat | f = `Qt::TextDate` | ) | const

Search for all occurrences

QString toString | ( | const QString & | format | ) | const

Search for all occurrences

bool setYMD | ( | int | y,
|  | int | m,
|  | int | d
| ) |  |

Search for all occurrences

bool setDate | ( | int | year,
|  | int | month,
|  | int | day
| ) |  |

Search for all occurrences

void getDate | ( | int * | year,
|  | int * | month,
|  | int * | day
| ) |  |

Search for all occurrences

QDate addDays | ( | int | days | ) | const

Search for all occurrences

QDate addMonths | ( | int | months | ) | const

Search for all occurrences

QDate addYears | ( | int | years | ) | const

Search for all occurrences

int daysTo | ( | const QDate & |  | ) | const

Search for all occurrences

bool operator== | ( | const QDate & | other | ) | const `[inline]`

Definition at line 107 of file qdatetime.h.

    { return jd == other.jd; }

bool operator!= | ( | const QDate & | other | ) | const `[inline]`

Definition at line 108 of file qdatetime.h.

    { return jd != other.jd; }

bool operator< | ( | const QDate & | other | ) | const `[inline]`

Definition at line 109 of file qdatetime.h.

    { return jd < other.jd; }

bool operator<= | ( | const QDate & | other | ) | const `[inline]`

Definition at line 110 of file qdatetime.h.

    { return jd <= other.jd; }

bool operator> | ( | const QDate & | other | ) | const `[inline]`

Definition at line 111 of file qdatetime.h.

    { return jd > other.jd; }

bool operator>= | ( | const QDate & | other | ) | const `[inline]`

Definition at line 112 of file qdatetime.h.

    { return jd >= other.jd; }

static QDate currentDate | ( |  | ) | `[static]`

Search for all occurrences

static QDate fromString | ( | const QString & | s,
|  | Qt::DateFormat | f = `Qt::TextDate`
| ) |  | `[static]`

Search for all occurrences

static QDate fromString | ( | const QString & | s,
|  | const QString & | format
| ) |  | `[static]`

Search for all occurrences

static bool isValid | ( | int | y,
|  | int | m,
|  | int | d
| ) |  | `[static]`

Search for all occurrences

static bool isLeapYear | ( | int | year | ) | `[static]`

Search for all occurrences

static uint gregorianToJulian | ( | int | y,
|  | int | m,
|  | int | d
| ) |  | `[static]`

Search for all occurrences

static void julianToGregorian | ( | uint | jd,
|  | int & | y,
|  | int & | m,
|  | int & | d
| ) |  | `[static]`

Search for all occurrences

static QDate fromJulianDay | ( | int | jd | ) | `[inline, static]`

Search for all occurrences

Definition at line 133 of file qdatetime.h.

    { QDate d; d.jd = jd; return d; }

int toJulianDay | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 134 of file qdatetime.h.

    { return jd; }

## Friends And Related Function Documentation

friend class QDateTime `[friend]`

Search for all occurrences

Definition at line 139 of file qdatetime.h.

friend class QDateTimePrivate `[friend]`

Search for all occurrences

Definition at line 140 of file qdatetime.h.

Q_CORE_EXPORT QDataStream& operator<< | ( | QDataStream & | ,
|  | const QDate & |
| ) |  | `[friend]`

Q_CORE_EXPORT QDataStream& operator>> | ( | QDataStream & | ,
|  | QDate & |
| ) |  | `[friend]`

The documentation for this class was generated from the following file:

- QtCore/qdatetime.h

QDate QDate QDate QDate QDate QDate QDate QDate QDate QDate
QDate QDate QDate QDate QDate QDate QDate QDate QDate QDate