|
QWT 7.0.1
|
A collection of methods around date/time values. More...
#include <qwt_date.h>
Public Types | |
| enum | Week0Type { FirstThursday , FirstDay } |
| How to identify the first week of year differs between countries. More... | |
| enum | IntervalType { Millisecond , Second , Minute , Hour , Day , Week , Month , Year } |
| Classification of an time interval. More... | |
| enum | { JulianDayForEpoch = 2440588 } |
Static Public Member Functions | |
| static QDate | minDate () |
| Minimum for the supported date range. | |
| static QDate | maxDate () |
| Maximum for the supported date range. | |
| static QDateTime | toDateTime (double value, Qt::TimeSpec=Qt::UTC) |
| Translate from double to QDateTime. | |
| static double | toDouble (const QDateTime &) |
| Translate from QDateTime to double. | |
| static QDateTime | ceil (const QDateTime &, IntervalType) |
| Ceil a datetime according the interval type. | |
| static QDateTime | floor (const QDateTime &, IntervalType) |
| Floor a datetime according the interval type. | |
| static QDate | dateOfWeek0 (int year, Week0Type) |
| Date of the first day of the first week for a year. | |
| static int | weekNumber (const QDate &, Week0Type) |
| Find the week number of a date. | |
| static int | utcOffset (const QDateTime &) |
| Offset in seconds from Coordinated Universal Time. | |
| static QString | toString (const QDateTime &, const QString &format, Week0Type) |
| Translate a datetime into a string. | |
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.
A double is interpreted as the number of milliseconds since 1970-01-01T00:00:00 Universal Coordinated Time - also known as "The Epoch".
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.
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.
Classification of an time interval.
Time intervals needs to be classified to decide how to align and divide it.
| enum QwtDate::Week0Type |
How to identify the first week of year differs between countries.
|
static |
Ceil a datetime according the interval type.
| 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 |
|
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() ).
| year | Year |
| type | Option how to identify the first week |
|
static |
Floor a datetime according the interval type.
| 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 |
|
static |
Maximum for the supported date range.
The range of valid dates depends on how QDate stores the Julian day internally.
|
static |
Minimum for the supported date range.
The range of valid dates depends on how QDate stores the Julian day internally.
|
static |
Translate from double to QDateTime.
| value | Number of milliseconds since the epoch, 1970-01-01T00:00:00 UTC |
| timeSpec | Time specification |
|
static |
Translate from QDateTime to double.
| dateTime | Datetime value |
|
static |
Translate a datetime into a string.
Beside the format expressions documented in QDateTime::toString() the following expressions are supported:
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.
| dateTime | Datetime value |
| format | Format string |
| week0Type | Specification of week 0 |
|
static |
Offset in seconds from Coordinated Universal Time.
The offset depends on the time specification of dateTime:
For Qt::LocalTime the offset depends on the timezone and daylight savings.
| dateTime | Datetime value |
|
static |
Find the week number of a date.
| date | Date |
| type | Option how to identify the first week |