and for manipulating dates. For example, it is possible to add
and subtract days, months, and years to dates.
- A QDate object is typically created either by giving the year,
+ A QDate object is typically created by giving the year,
month, and day numbers explicitly. Note that QDate interprets two
digit years as is, i.e., years 0 - 99. A QDate can also be
constructed with the static function currentDate(), which creates
date of this object (or earlier if \a ndays is negative).
Returns a null date if the current date is invalid or the new date is
- out-of-range.
+ out of range.
\sa addMonths(), addYears(), daysTo()
*/
the toString() function.
QTime provides a full set of operators to compare two QTime
- objects. One time is considered smaller than another if it is
- earlier than the other.
+ objects. QTime A is considered smaller than QTime B if A is
+ earlier than B.
- The time a given number of seconds or milliseconds later than a
- given time can be found using the addSecs() or addMSecs()
- functions. Correspondingly, the number of seconds or milliseconds
+ The addSecs() and addMSecs() functions provide the time a given
+ number of seconds or milliseconds later than a given time.
+ Correspondingly, the number of seconds or milliseconds
between two times can be found using secsTo() or msecsTo().
QTime can be used to measure a span of elapsed time using the
\row \li H:m:s a \li 14:13:9 pm
\endtable
- If the datetime is invalid, an empty string will be returned.
+ If the time is invalid, an empty string will be returned.
If \a format is empty, the default format "hh:mm:ss" is used.
\sa QDate::toString(), QDateTime::toString()
\snippet code/src_corelib_tools_qdatetime.cpp 6
- If the format is not satisfied an invalid QTime is returned.
+ If the format is not satisfied, an invalid QTime is returned.
Expressions that do not expect leading zeroes to be given (h, m, s
and z) are greedy. This means that they will use two digits even if
this puts them outside the range of accepted values and leaves too
textual format by the toString() function.
QDateTime provides a full set of operators to compare two
- QDateTime objects where smaller means earlier and larger means
+ QDateTime objects, where smaller means earlier and larger means
later.
You can increment (or decrement) a datetime by a given number of
milliseconds using addMSecs(), seconds using addSecs(), or days
- using addDays(). Similarly you can use addMonths() and addYears().
+ using addDays(). Similarly, you can use addMonths() and addYears().
The daysTo() function returns the number of days between two datetimes,
secsTo() returns the number of seconds between two datetimes, and
msecsTo() returns the number of milliseconds between two datetimes.
\section2 Range of Valid Dates
- Dates are stored internally as a Julian Day number, an interger count of
+ Dates are stored internally as a Julian Day number, an integer count of
every day in a contiguous range, with 24 November 4714 BCE in the Gregorian
calendar being Julian Day 0 (1 January 4713 BCE in the Julian calendar).
As well as being an efficient and accurate way of storing an absolute date,
\fn void QDateTime::swap(QDateTime &other)
\since 5.0
- Swaps this date-time with \a other. This operation is very fast
+ Swaps this datetime with \a other. This operation is very fast
and never fails.
*/
/*!
\since 4.7
- Sets the date and time given the number of milliseconds,\a msecs, that have
+ Sets the date and time given the number of milliseconds \a msecs that have
passed since 1970-01-01T00:00:00.000, Coordinated Universal Time
(Qt::UTC). On systems that do not support time zones this function
will behave as if local time were Qt::UTC.
dates and times, taking the form YYYY-MM-DDTHH:MM:SS[Z|[+|-]HH:MM],
depending on the timeSpec() of the QDateTime. If the timeSpec()
is Qt::UTC, Z will be appended to the string; if the timeSpec() is
- Qt::OffsetFromUTC the offset in hours and minutes from UTC will
+ Qt::OffsetFromUTC, the offset in hours and minutes from UTC will
be appended to the string.
If the \a format is Qt::SystemLocaleShortDate or
detach();
/* The motivation to also setting d->spec is to ensure that the QDateTime
- * instance stay in well-defined states all the time, instead of that
+ * instance stays in well-defined states all the time; instead of that,
* we instruct the user to ensure it. */
if(seconds == 0)
d->spec = QDateTimePrivate::UTC;
Returns the UTC offset in seconds. If the timeSpec() isn't
Qt::OffsetFromUTC, 0 is returned. However, since 0 is a valid UTC
- offset the return value of this function cannot be used to determine
- whether a utcOffset() is used or is valid, timeSpec() must be
+ offset, the return value of this function cannot be used to determine
+ whether a utcOffset() is used or is valid; in that case, timeSpec() must be
checked.
Likewise, if this QDateTime() is invalid or if timeSpec() isn't
\snippet code/src_corelib_tools_qdatetime.cpp 12
- If the format is not satisfied an invalid QDateTime is returned.
+ If the format is not satisfied, an invalid QDateTime is returned.
The expressions that don't have leading zeroes (d, M, h, m, s, z) will be
greedy. This means that they will use two digits even if this will
put them outside the range and/or leave too few digits for other
This could have meant 1 January 00:30.00 but the M will grab
two digits.
- For any field that is not represented in the format the following
+ For any field that is not represented in the format, the following
defaults are used:
\table
-// checks if there is an unqoted 'AP' or 'ap' in the string
+// checks if there is an unquoted 'AP' or 'ap' in the string
static bool hasUnquotedAP(const QString &f)
{
const QLatin1Char quote('\'');