QDateTime Class Reference

#include <qdatetime.h>

Class Description

Definition at line 216 of file qdatetime.h.

Public Member Functions

 QDateTime ()
 
 QDateTime (const QDate &)
 
 QDateTime (const QDate &, const QTime &, Qt::TimeSpec spec=Qt::LocalTime)
 
 QDateTime (const QDateTime &other)
 
 ~QDateTime ()
 
QDateTimeoperator= (const QDateTime &other)
 
bool isNull () const
 
bool isValid () const
 
QDate date () const
 
QTime time () const
 
Qt::TimeSpec timeSpec () const
 
qint64 toMSecsSinceEpoch () const
 
uint toTime_t () const
 
void setDate (const QDate &date)
 
void setTime (const QTime &time)
 
void setTimeSpec (Qt::TimeSpec spec)
 
void setMSecsSinceEpoch (qint64 msecs)
 
void setTime_t (uint secsSince1Jan1970UTC)
 
QString toString (Qt::DateFormat f=Qt::TextDate) const
 
QString toString (const QString &format) const
 
QDateTime addDays (int days) const
 
QDateTime addMonths (int months) const
 
QDateTime addYears (int years) const
 
QDateTime addSecs (int secs) const
 
QDateTime addMSecs (qint64 msecs) const
 
QDateTime toTimeSpec (Qt::TimeSpec spec) const
 
QDateTime toLocalTime () const
 
QDateTime toUTC () const
 
int daysTo (const QDateTime &) const
 
int secsTo (const QDateTime &) const
 
qint64 msecsTo (const QDateTime &) const
 
bool operator== (const QDateTime &other) const
 
bool operator!= (const QDateTime &other) const
 
bool operator< (const QDateTime &other) const
 
bool operator<= (const QDateTime &other) const
 
bool operator> (const QDateTime &other) const
 
bool operator>= (const QDateTime &other) const
 
void setUtcOffset (int seconds)
 
int utcOffset () const
 

Static Public Member Functions

static QDateTime currentDateTime ()
 
static QDateTime currentDateTimeUtc ()
 
static QDateTime fromString (const QString &s, Qt::DateFormat f=Qt::TextDate)
 
static QDateTime fromString (const QString &s, const QString &format)
 
static QDateTime fromTime_t (uint secsSince1Jan1970UTC)
 
static QDateTime fromMSecsSinceEpoch (qint64 msecs)
 
static qint64 currentMSecsSinceEpoch ()
 

Friends

class QDateTimePrivate
 
Q_CORE_EXPORT QDataStreamoperator<< (QDataStream &, const QDateTime &)
 
Q_CORE_EXPORT QDataStreamoperator>> (QDataStream &, QDateTime &)
 

Constructor & Destructor Documentation

QDateTime ( )
QDateTime ( const QDate )
explicit
QDateTime ( const QDate ,
const QTime ,
Qt::TimeSpec  spec = Qt::LocalTime 
)
QDateTime ( const QDateTime other)
~QDateTime ( )

Member Function Documentation

QDateTime& operator= ( const QDateTime other)
bool isNull ( ) const
bool isValid ( ) const
QDate date ( ) const
QTime time ( ) const
Qt::TimeSpec timeSpec ( ) const
qint64 toMSecsSinceEpoch ( ) const
uint toTime_t ( ) const
void setDate ( const QDate date)
void setTime ( const QTime time)
void setTimeSpec ( Qt::TimeSpec  spec)
void setMSecsSinceEpoch ( qint64  msecs)
void setTime_t ( uint  secsSince1Jan1970UTC)
QString toString ( Qt::DateFormat  f = Qt::TextDate) const
QString toString ( const QString format) const
QDateTime addDays ( int  days) const
QDateTime addMonths ( int  months) const
QDateTime addYears ( int  years) const
QDateTime addSecs ( int  secs) const
QDateTime addMSecs ( qint64  msecs) const
QDateTime toTimeSpec ( Qt::TimeSpec  spec) const
QDateTime toLocalTime ( ) const
inline

Definition at line 250 of file qdatetime.h.

250 { return toTimeSpec(Qt::LocalTime); }
QDateTime toTimeSpec(Qt::TimeSpec spec) const
QDateTime toUTC ( ) const
inline

Definition at line 251 of file qdatetime.h.

251 { return toTimeSpec(Qt::UTC); }
QDateTime toTimeSpec(Qt::TimeSpec spec) const
int daysTo ( const QDateTime ) const
int secsTo ( const QDateTime ) const
qint64 msecsTo ( const QDateTime ) const
bool operator== ( const QDateTime other) const
bool operator!= ( const QDateTime other) const
inline

Definition at line 257 of file qdatetime.h.

257 { return !(*this == other); }
bool operator< ( const QDateTime other) const
bool operator<= ( const QDateTime other) const
inline

Definition at line 259 of file qdatetime.h.

259 { return !(other < *this); }
bool operator> ( const QDateTime other) const
inline

Definition at line 260 of file qdatetime.h.

260 { return other < *this; }
bool operator>= ( const QDateTime other) const
inline

Definition at line 261 of file qdatetime.h.

261 { return !(*this < other); }
void setUtcOffset ( int  seconds)
int utcOffset ( ) const
static QDateTime currentDateTime ( )
static
static QDateTime currentDateTimeUtc ( )
static
static QDateTime fromString ( const QString s,
Qt::DateFormat  f = Qt::TextDate 
)
static
static QDateTime fromString ( const QString s,
const QString format 
)
static
static QDateTime fromTime_t ( uint  secsSince1Jan1970UTC)
static
static QDateTime fromMSecsSinceEpoch ( qint64  msecs)
static
static qint64 currentMSecsSinceEpoch ( )
static

Friends And Related Function Documentation

friend class QDateTimePrivate
friend

Definition at line 292 of file qdatetime.h.

Q_CORE_EXPORT QDataStream& operator<< ( QDataStream ,
const QDateTime  
)
friend
Q_CORE_EXPORT QDataStream& operator>> ( QDataStream ,
QDateTime  
)
friend

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