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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Friends

# QDateTime Class Reference

Search for all occurrences

## Detailed Description

Definition at line 216 of file qdatetime.h.

`#include <qdatetime.h>`

List of all members.

## Public Member Functions
| QDateTime ()
| QDateTime (const QDate &)
| QDateTime (const QDate &, const QTime &, Qt::TimeSpec spec=Qt::LocalTime)
| QDateTime (const QDateTime &other)
| ~QDateTime ()
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
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 QDataStream & | operator<< (QDataStream &, const QDateTime &)
Q_CORE_EXPORT QDataStream & | operator>> (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

Search for all occurrences

bool isValid | ( |  | ) | const

Search for all occurrences

QDate date | ( |  | ) | const

Search for all occurrences

QTime time | ( |  | ) | const

Search for all occurrences

Qt::TimeSpec timeSpec | ( |  | ) | const

Search for all occurrences

qint64 toMSecsSinceEpoch | ( |  | ) | const

Search for all occurrences

uint toTime_t | ( |  | ) | const

Search for all occurrences

void setDate | ( | const QDate & | date | ) |

Search for all occurrences

void setTime | ( | const QTime & | time | ) |

Search for all occurrences

void setTimeSpec | ( | Qt::TimeSpec | spec | ) |

Search for all occurrences

void setMSecsSinceEpoch | ( | qint64 | msecs | ) |

Search for all occurrences

void setTime_t | ( | uint | secsSince1Jan1970UTC | ) |

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

QDateTime addDays | ( | int | days | ) | const

Search for all occurrences

QDateTime addMonths | ( | int | months | ) | const

Search for all occurrences

QDateTime addYears | ( | int | years | ) | const

Search for all occurrences

QDateTime addSecs | ( | int | secs | ) | const

Search for all occurrences

QDateTime addMSecs | ( | qint64 | msecs | ) | const

Search for all occurrences

QDateTime toTimeSpec | ( | Qt::TimeSpec | spec | ) | const

Search for all occurrences

QDateTime toLocalTime | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 250 of file qdatetime.h.

    { return toTimeSpec(Qt::LocalTime); }

QDateTime toUTC | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 251 of file qdatetime.h.

    { return toTimeSpec(Qt::UTC); }

int daysTo | ( | const QDateTime & |  | ) | const

Search for all occurrences

int secsTo | ( | const QDateTime & |  | ) | const

Search for all occurrences

qint64 msecsTo | ( | const QDateTime & |  | ) | const

Search for all occurrences

bool operator== | ( | const QDateTime & | other | ) | const

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

Definition at line 257 of file qdatetime.h.

    { return !(*this == other); }

bool operator< | ( | const QDateTime & | other | ) | const

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

Definition at line 259 of file qdatetime.h.

    { return !(other < *this); }

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

Definition at line 260 of file qdatetime.h.

    { return other < *this; }

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

Definition at line 261 of file qdatetime.h.

    { return !(*this < other); }

void setUtcOffset | ( | int | seconds | ) |

Search for all occurrences

int utcOffset | ( |  | ) | const

Search for all occurrences

static QDateTime currentDateTime | ( |  | ) | `[static]`

Search for all occurrences

static QDateTime currentDateTimeUtc | ( |  | ) | `[static]`

Search for all occurrences

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

Search for all occurrences

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

Search for all occurrences

static QDateTime fromTime_t | ( | uint | secsSince1Jan1970UTC | ) | `[static]`

Search for all occurrences

static QDateTime fromMSecsSinceEpoch | ( | qint64 | msecs | ) | `[static]`

Search for all occurrences

static qint64 currentMSecsSinceEpoch | ( |  | ) | `[static]`

Search for all occurrences

## Friends And Related Function Documentation

friend class QDateTimePrivate `[friend]`

Search for all occurrences

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:

- QtCore/qdatetime.h

QDateTime QDateTime QDateTime QDateTime QDateTime QDateTime QDateTime QDateTime QDateTime QDateTime
QDateTime QDateTime QDateTime QDateTime QDateTime QDateTime QDateTime QDateTime QDateTime QDateTime