|
KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
|
|
#include <datetimeutil.h>
Static Public Member Functions | |
| static QDateTime | fromISOString (const QString &date) |
| Parse an ISO-8601 string into a UTC QDateTime. | |
| static QDateTime | fromStandardString (const QString &date) |
| Parse a MySQL-style "yyyy-MM-dd hh:mm:ss.zzz" string into a QDateTime. | |
| static QDateTime | fromSquashedString (const QString &date) |
| Parse a compact "yyyyMMddhhmmsszzz" string into a QDateTime. | |
| static QDateTime | fromString (const QString &date) |
| Parse a date/time string, trying multiple known formats. | |
| static QDateTime | fromVariant (const QVariant &date) |
| Parse a QVariant containing a date/time string or QDateTime. | |
| static QString | toStandardString (const QDateTime &date, bool milliseconds=true) |
| Format a QDateTime as a MySQL-style string. | |
| static QString | toISOString (const QDateTime &date) |
| Format a QDateTime as an ISO-8601 Zulu string. | |
| static QString | toSquashedString (const QDateTime &date) |
| Format a QDateTime as a compact squashed string. | |
| static QString | toStandardTimeString (const QDateTime &date) |
| Format the time portion of a QDateTime as "HH:mm:ss.zzz". | |
| static QString | toStandardDateString (const QDateTime &date) |
| Format the date portion of a QDateTime as "yyyy-MM-dd". | |
| static QString | currentToISOString () |
| Return the current UTC time as an ISO-8601 Zulu string. | |
| static QString | currentToStandardString (bool milliseconds=true) |
| Return the current UTC time as a MySQL-style string. | |
| static QString | currentToSquashedString () |
| Return the current UTC time as a compact squashed string. | |
Some static helper methods for converting date/times to and from strings.
In general, on of two formats are preferred:
Stephen Punak, September 17 2020
Static helper methods for parsing and formatting QDateTime values.
Supports ISO-8601 Zulu (e.g. 2021-09-17T05:30:00.123Z) and MySQL-style (e.g. 2021-09-17 05:30:00.123) formats as well as a compact "squashed" form.
Definition at line 26 of file datetimeutil.h.
|
inlinestatic |
Return the current UTC time as an ISO-8601 Zulu string.
Definition at line 112 of file datetimeutil.h.
|
inlinestatic |
Return the current UTC time as a compact squashed string.
Definition at line 128 of file datetimeutil.h.
|
inlinestatic |
Return the current UTC time as a MySQL-style string.
| milliseconds | Whether to include milliseconds (default true) |
Definition at line 119 of file datetimeutil.h.
|
inlinestatic |
Parse an ISO-8601 string into a UTC QDateTime.
| date | ISO-8601 date/time string with milliseconds |
Definition at line 34 of file datetimeutil.h.
|
static |
Parse a compact "yyyyMMddhhmmsszzz" string into a QDateTime.
| date | Squashed format date/time string |
|
static |
Parse a MySQL-style "yyyy-MM-dd hh:mm:ss.zzz" string into a QDateTime.
| date | MySQL format date/time string |
|
static |
Parse a date/time string, trying multiple known formats.
| date | Date/time string in any supported format |
|
static |
Parse a QVariant containing a date/time string or QDateTime.
| date | Variant holding a date/time value |
|
inlinestatic |
Format a QDateTime as an ISO-8601 Zulu string.
| date | Date/time to format |
Definition at line 85 of file datetimeutil.h.
|
inlinestatic |
Format a QDateTime as a compact squashed string.
| date | Date/time to format |
Definition at line 92 of file datetimeutil.h.
|
inlinestatic |
Format the date portion of a QDateTime as "yyyy-MM-dd".
| date | Date/time whose date portion to format |
Definition at line 106 of file datetimeutil.h.
|
inlinestatic |
Format a QDateTime as a MySQL-style string.
| date | Date/time to format |
| milliseconds | Whether to include milliseconds (default true) |
Definition at line 75 of file datetimeutil.h.
|
inlinestatic |
Format the time portion of a QDateTime as "HH:mm:ss.zzz".
| date | Date/time whose time portion to format |
Definition at line 99 of file datetimeutil.h.