#include <datetime.h>
Public Member Functions | |
| DateTime () | |
| DateTime (const QDateTime &rOther) | |
| DateTime (const QDate &rDate, const QTime &rTime, Qt::TimeSpec timeSpec=Qt::LocalTime) | |
| DateTime & | operator= (const DateTime &rOther) |
| qint64 | toMilliSeconds () const |
| QString | toString (const QString &rFormat) const |
Static Public Member Functions | |
| static DateTime | currentDateTime () |
| static DateTime | fromMilliSeconds (qint64 milliSeconds) |
The class DateTime implements additional formatting options for toString() and provides conversion functions from and to milliseconds.
| Log4Qt::DateTime::DateTime | ( | ) | [inline] |
Constructs a null date time.
Referenced by currentDateTime(), and fromMilliSeconds().
| Log4Qt::DateTime::DateTime | ( | const QDateTime & | rOther | ) | [inline] |
Constructs a copy of another QDateTime.
| Log4Qt::DateTime::DateTime | ( | const QDate & | rDate, | |
| const QTime & | rTime, | |||
| Qt::TimeSpec | timeSpec = Qt::LocalTime | |||
| ) | [inline] |
Constructs a datetime with the given rDate and rTime, using the time specification defined by timeSpec.
Assigns rOther to this DateTime and returns a reference to it.
| qint64 Log4Qt::DateTime::toMilliSeconds | ( | ) | const [inline] |
Returns the datetime as the number of milliseconds that have passed since 1970-01-01T00:00:00,000, Coordinated Universal Time (Qt::UTC).
| QString Log4Qt::DateTime::toString | ( | const QString & | rFormat | ) | const |
Returns the datetime as a string. The rFormat parameter determines the format of the result string.
In addition to the expressions of QDateTime::toString(const QString &rFormat) the following expression can be used.
| Expression | Output |
|---|---|
| w | the week of the year as number without a leading zero (1 to 53) |
| ww | the week of the year as number with a leading zero (01 to 53) |
Alternatively the rFormat parameter can specify one of the following strings.
| String | Format |
|---|---|
| ABSOLUTE | uses the format HH:mm:ss.zzz |
| DATE | uses the format dd MMM YYYY HH:mm:ss.zzzz |
| ISO8601 | uses the format yyyy-MM-dd hh:mm:ss.zzz |
| NONE | uses an empty string as format |
| RELATIVE | returns the milliseconds since start of the program |
| DateTime Log4Qt::DateTime::currentDateTime | ( | ) | [inline, static] |
Returns the current datetime, as reported by the system clock, in the local time zone.
References DateTime().
| DateTime Log4Qt::DateTime::fromMilliSeconds | ( | qint64 | milliSeconds | ) | [inline, static] |
Returns a datetime whose date and time are the number of milliseconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (Qt::UTC).
References DateTime().
1.5.6