QDate Class Reference

#include <qdatetime.h>

Class Description

Definition at line 55 of file qdatetime.h.

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 QDataStreamoperator<< (QDataStream &, const QDate &)
 
Q_CORE_EXPORT QDataStreamoperator>> (QDataStream &, QDate &)
 

Member Enumeration Documentation

Enumerator
DateFormat 
StandaloneFormat 

Definition at line 58 of file qdatetime.h.

Constructor & Destructor Documentation

QDate ( )
inline

Definition at line 63 of file qdatetime.h.

63 { jd = 0; }
QDate ( int  y,
int  m,
int  d 
)

Member Function Documentation

bool isNull ( ) const
inline

Definition at line 66 of file qdatetime.h.

66 { return jd == 0; }
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
static QString shortMonthName ( int  month)
static
static QString shortMonthName ( int  month,
MonthNameType  type 
)
static
static QString shortDayName ( int  weekday)
static
static QString shortDayName ( int  weekday,
MonthNameType  type 
)
static
static QString longMonthName ( int  month)
static
static QString longMonthName ( int  month,
MonthNameType  type 
)
static
static QString longDayName ( int  weekday)
static
static QString longDayName ( int  weekday,
MonthNameType  type 
)
static
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
inline

Definition at line 107 of file qdatetime.h.

107 { return jd == other.jd; }
bool operator!= ( const QDate other) const
inline

Definition at line 108 of file qdatetime.h.

108 { return jd != other.jd; }
bool operator< ( const QDate other) const
inline

Definition at line 109 of file qdatetime.h.

109 { return jd < other.jd; }
bool operator<= ( const QDate other) const
inline

Definition at line 110 of file qdatetime.h.

110 { return jd <= other.jd; }
bool operator> ( const QDate other) const
inline

Definition at line 111 of file qdatetime.h.

111 { return jd > other.jd; }
bool operator>= ( const QDate other) const
inline

Definition at line 112 of file qdatetime.h.

112 { return jd >= other.jd; }
static QDate currentDate ( )
static
static QDate fromString ( const QString s,
Qt::DateFormat  f = Qt::TextDate 
)
static
static QDate fromString ( const QString s,
const QString format 
)
static
static bool isValid ( int  y,
int  m,
int  d 
)
static
static bool isLeapYear ( int  year)
static
static uint gregorianToJulian ( int  y,
int  m,
int  d 
)
static
static void julianToGregorian ( uint  jd,
int y,
int m,
int d 
)
static
static QDate fromJulianDay ( int  jd)
inlinestatic

Definition at line 133 of file qdatetime.h.

133 { QDate d; d.jd = jd; return d; }
int toJulianDay ( ) const
inline

Definition at line 134 of file qdatetime.h.

134 { return jd; }

Friends And Related Function Documentation

friend class QDateTime
friend

Definition at line 139 of file qdatetime.h.

friend class QDateTimePrivate
friend

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: