13QDate date = QDate::fromString(
"1MM12car2003",
"d'MM'MMcaryyyy");
19QDate date = QDate::fromString(
"130",
"Md");
24QDate::fromString(
"1.30",
"M.d");
25QDate::fromString(
"20000110",
"yyyyMMdd");
26QDate::fromString(
"20000110",
"yyyyMd");
52QTime time = QTime::fromString(
"1mm12car00",
"m'mm'hcarss");
58QTime time = QTime::fromString(
"00:710",
"hh:ms");
63QTime time = QTime::fromString(
"1.30",
"m.s");
84QTime time1 = QTime::fromString(
"1apA",
"1amAM");
88 "'M'M'd'd'y'yyhh:mm:ss");
101dateTime = QDateTime::fromString(
"12",
"yy");
121qDebug() <<
"Local time is:" << local;
123qDebug() <<
"No difference between times:" << local.secsTo(
UTC);
130qDebug() <<
"Local time is:" << local;
131qDebug() <<
"No difference between times:" <<
UTC.secsTo(local);
137qDebug() <<
"Local time is:" << local;
139qDebug() <<
"No difference between times:" << local.secsTo(
UTC);
144qDebug() <<
"Local time is:" << local;
150qDebug() <<
"There are" << local.secsTo(
UTC) <<
"seconds difference between the datetimes.";
154QString string =
"Monday, 23 April 12 22:51:41";
160QString string =
"Tuesday, 23 April 12 22:51:41";
167QDate date = std::chrono::year_month_day(std::chrono::year(2012),
168 std::chrono::month(4),
169 std::chrono::day(23));
172QDate dateWithLiterals1 = 23 / April / 2012
y;
173QDate dateWithLiterals2 = 2012
y / April / 23;
176QDate lastDayFeb2020 = 2000
y / February / last;
179QDate firstMonday = 2020
y / January / Monday[0];
182QDate lastMonday = 2020
y / January / Monday[last];
188qDebug() <<
"Local time is:" << local;
190qDebug() <<
"No difference between times represented:" << local.secsTo(
UTC);
\inmodule QtCore\reentrant
static QDateTime currentDateTime()
This is an overloaded member function, provided for convenience. It differs from the above function o...
qint64 secsTo(const QDateTime &) const
Returns the number of seconds from this datetime to the other datetime.
static QDateTime currentDateTimeUtc()
qint64 daysTo(const QDateTime &) const
Returns the number of days from this datetime to the other datetime.
QDate date() const
Returns the date part of the datetime.
\inmodule QtCore \reentrant
qint64 daysTo(QDate d) const
Returns the number of days from this date to d (which is negative if d is earlier than this date).
constexpr bool isValid() const
Returns true if this date is valid; otherwise returns false.
int year() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QDateTime startOfDay(const QTimeZone &zone) const
\macro QT_RESTRICTED_CAST_FROM_ASCII
\inmodule QtCore \reentrant
bool isValid() const
Returns true if the time is valid; otherwise returns false.
QTime addSecs(int secs) const
Returns a QTime object containing a time s seconds later than the time of this object (or earlier if ...
GLint GLsizei GLsizei GLenum format
static double UTC(double t, double localTZA)
QDateTime startDate(QDate(2012, 7, 6), QTime(8, 30, 0))
[14]
QDateTime xmas(QDate(now.date().year(), 12, 25).startOfDay())
QDateTime endDate(QDate(2012, 7, 7), QTime(16, 30, 0))