QwtDate(3)
QwtDate(3) from the Library Functions Manual β okay bestie, this is the Qwt date/time page, and it's literally a collection of methods around date/time values. We're translating between Qt date objects and doubles, doing week math, and aligning axes. It's giving practical magic. πβ¨
π NAME π
QwtDate β A collection of methods around date/time values. That's the name, that's the vibe, and it ate. π
π¦ SYNOPSIS π¦
First, the include, because we're not animals:
#include <qwt_date.h>
π Public Types π
enum Week0Type { FirstThursday, FirstDay }
enum IntervalType { Millisecond, Second, Minute, Hour, Day, Week, Month,
Year }
enum { JulianDayForEpoch = 2440588 }
β¨ Static Public Member Functions β¨
static QDate minDate ()
static QDate maxDate ()
static QDateTime toDateTime (double value, Qt::TimeSpec=Qt::UTC)
static double toDouble (const QDateTime &)
static QDateTime ceil (const QDateTime &, IntervalType)
static QDateTime floor (const QDateTime &, IntervalType)
static QDate dateOfWeek0 (int year, Week0Type)
Date of the first day of the first week for a year.
static int weekNumber (const QDate &, Week0Type)
static int utcOffset (const QDateTime &)
static QString toString (const QDateTime &, const QString &format,
Week0Type)
That's the whole API menu, and yes, dateOfWeek0 comes with its own one-liner in the middle. Iconic. π«Ά
πΈ Detailed Description πΈ
A collection of methods around date/time values.
Qt offers convenient classes for dealing with date/time values, but Qwt uses coordinate systems that are based on doubles. QwtDate offers methods to translate from QDateTime to double and v.v. So it's the bridge between Qt's date objects and Qwt's double-based world. π
A double is interpreted as the number of milliseconds since 1970-01-01T00:00:00 Universal Coordinated Time β also known as "The Epoch". The Epoch is the main character here, periodt. π
While the range of the Julian day in Qt4 is limited to [0, MAX_INT], Qt5 stores it as qint64 offering a huge range of valid dates. As the significance of a double is below this ( assuming a fraction of 52 bits ) the translation is not bijective with rounding errors for dates very far from Epoch. For a resolution of 1 ms those start to happen for dates above the year 144683. π That's the caveat, bestie, and we respect it.
An axis for a date/time interval is expected to be aligned and divided in time/date units like seconds, minutes, ... QwtDate offers several algorithms that are needed to calculate these axes. It's giving axis math, and honestly? Obsessed. β¨
See also: QwtDateScaleEngine, QwtDateScaleDraw, QDate, QTime
Definition: Definition at line 42 of file qwt_date.h.
π§ Member Enumeration Documentation π§
anonymous enum
Okay so there's an anonymous enum, and its one enumerator is doing the most:
JulianDayForEpochβ The Julian day of "The Epoch". π
Definition: Definition at line 102 of file qwt_date.h.
enum QwtDate::IntervalType
Classification of an time interval. Time intervals needs to be classified to decide how to align and divide it. Grammar? Never met her, but the facts are facts bestie. π
Millisecondβ The interval is related to milliseconds.Secondβ The interval is related to seconds.Minuteβ The interval is related to minutes.Hourβ The interval is related to hours.Dayβ The interval is related to days.Weekβ The interval is related to weeks.Monthβ The interval is related to months.Yearβ The interval is related to years.
Definition: Definition at line 75 of file qwt_date.h.
enum QwtDate::Week0Type
How to identify the first week of year differs between countries. International queen behavior. π
FirstThursdayβ According to ISO 8601 the first week of a year is defined as "the week with the year's first Thursday in it".
FirstThursday corresponds to the numbering that is implemented in QDate::weekNumber().
FirstDayβ "The week with January 1.1 in it."
In the U.S. this definition is more common than FirstThursday.
Definition: Definition at line 49 of file qwt_date.h.
π Member Function Documentation π
QDateTime QwtDate::ceil (const QDateTime & dateTime, IntervalType intervalType) [static]
Ceil a datetime according the interval type. No cap, it's ceiling time. π¦
Parameters
- dateTime β Datetime value.
- intervalType β Interval type, how to ceil. F.e. when
intervalType = QwtDate::Months, the result will be ceiled to the next beginning of a month.
Returns: Ceiled datetime.
See also: floor()
Definition: Definition at line 323 of file qwt_date.cpp.
QDate QwtDate::dateOfWeek0 (int year, Week0Type type) [static]
Date of the first day of the first week for a year. The first day of a week depends on the current locale ( QLocale::firstDayOfWeek() ). So yes, your locale is part of the plot. π
Parameters
- year β Year.
- type β Option how to identify the first week.
Returns: First day of week 0.
See also: QLocale::firstDayOfWeek(), weekNumber()
Definition: Definition at line 542 of file qwt_date.cpp.
QDateTime QwtDate::floor (const QDateTime & dateTime, IntervalType intervalType) [static]
Floor a datetime according the interval type. We're going down, bestie, and the floor is iconic. π§
Parameters
- dateTime β Datetime value.
- intervalType β Interval type, how to ceil. F.e. when
intervalType = QwtDate::Months, the result will be ceiled to the next beginning of a month.
Yes, the parameter description in the original floor entry literally says "how to ceil" and QwtDate::Months β I'm preserving the lore exactly, no edits. π
Returns: Floored datetime.
See also: floor() β yes, it points at itself, self-love is real.
Definition: Definition at line 425 of file qwt_date.cpp.
QDate QwtDate::maxDate () [static]
Maximum for the supported date range. The range of valid dates depends on how QDate stores the Julian day internally. π
- For Qt4 it is
"Tue Jun 3 5874898" - For Qt5 it is
"Tue Dec 31 2147483647"
Returns: maximum of the date range.
See also: minDate()
Note: The maximum differs between Qt4 and Qt5.
Definition: Definition at line 521 of file qwt_date.cpp.
QDate QwtDate::minDate () [static]
Minimum for the supported date range. The range of valid dates depends on how QDate stores the Julian day internally. ποΈ
- For Qt4 it is
"Tue Jan 2 -4713" - For Qt5 it is
"Thu Jan 1 -2147483648"
Returns: minimum of the date range.
See also: maxDate()
Definition: Definition at line 499 of file qwt_date.cpp.
QDateTime QwtDate::toDateTime (double value, Qt::TimeSpec timeSpec = Qt::UTC) [static]
Translate from double to QDateTime. The glow-up from number to date object. β¨
Parameters
- value β Number of milliseconds since the epoch,
1970-01-01T00:00:00UTC. - timeSpec β Time specification.
Returns: Datetime value.
See also: toDouble(), QDateTime::setMSecsSinceEpoch()
Note: The return datetime forQt::OffsetFromUTCwill beQt::UTC.
Definition: Definition at line 261 of file qwt_date.cpp.
double QwtDate::toDouble (const QDateTime & dateTime) [static]
Translate from QDateTime to double. Turning the date object into a lil number, iykyk. π
Parameters
- dateTime β Datetime value.
Returns: Number of milliseconds since 1970-01-01T00:00:00 UTC has passed.
See also: toDateTime(), QDateTime::toMSecsSinceEpoch()
Warning: For values very far below or above1970-01-01UTC rounding errors will happen due to the limited significance of adouble. This is the limitation bit, so don't ignore it. π
Definition: Definition at line 298 of file qwt_date.cpp.
QString QwtDate::toString (const QDateTime & dateTime, const QString & format, Week0Type week0Type) [static]
Translate a datetime into a string. Beside the format expressions documented in QDateTime::toString() the following expressions are supported: π
wβ week number: ( 1 - 53 )wwβ week number with a leading zero ( 01 - 53 )
As week 1 usually starts in the previous year a special rule is applied for formats, where the year is expected to match the week number - even if the date belongs to the previous year. Time is a social construct and week 1 knows it. π
Parameters
- dateTime β Datetime value.
- format β Format string.
- week0Type β Specification of week 0.
Returns: Datetime string.
See also: QDateTime::toString(), weekNumber(), QwtDateScaleDraw
Definition: Definition at line 686 of file qwt_date.cpp.
int QwtDate::utcOffset (const QDateTime & dateTime) [static]
Offset in seconds from Coordinated Universal Time. The offset depends on the time specification of dateTime: π
Qt::UTCβ0,dateTimehas no offset.Qt::OffsetFromUTCβ returnsdateTime.offsetFromUtc().Qt::LocalTimeβ number of seconds from the UTC.
For Qt::LocalTime the offset depends on the timezone and daylight savings. DST is the villain in every calendar app, fr fr. π
Parameters
- dateTime β Datetime value.
Returns: Offset in seconds.
Definition: Definition at line 635 of file qwt_date.cpp.
int QwtDate::weekNumber (const QDate & date, Week0Type type) [static]
Find the week number of a date. Week math, but make it cute. ποΈ
QwtDate::FirstThursdayβ Corresponding to ISO 8601 ( seeQDate::weekNumber()).QwtDate::FirstDayβ Number of weeks that have begun sincedateOfWeek0().
Parameters
- date β Date.
- type β Option how to identify the first week.
Returns: Week number, starting with 1.
Definition: Definition at line 585 of file qwt_date.cpp.
π«Ά Author π«Ά
Generated automatically by Doxygen for Qwt User's Guide from the source code. So yes, the robots wrote it, and they ate. π€π
Final cute sign-off π«: this page is from the Qwt User's Guide source/version, and the footer's source/version-and-date tag is Qwt User's Guide / QwtDate(3) β generated automatically by Doxygen from the source code. Slay, and go align some axes. π β¨
π¦ where this page comes from
- alpine 3.24: qwt-doc 6.3.0-r0 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms