DateTime Class Reference

#include <datetime.h>

Static Public Member Functions

static QDateTime fromPathFriendlyUTCISO8601 (const QString &)
 
static QString toISO8601 (const QDateTime &)
 
static QString toPathFriendlyUTCISO8601 (const QDateTime &)
 

Detailed Description

Date and time utility class.

Definition at line 32 of file datetime.h.

Member Function Documentation

QDateTime DateTime::fromPathFriendlyUTCISO8601 ( const QString &  datetime)
static

Parse the output of toPathFriendlyUTCISO8601() into a QDateTime.

Returns
The QDateTime is returned in the UTC timezone.

Definition at line 36 of file datetime.cpp.

QString DateTime::toISO8601 ( const QDateTime &  datetime)
static

Format QDateTime in the ISO 8601 format with the timezone offset.

Unlike the Qt's built-in QDateTime::toString(Qt::ISODate), this converter ensures that the timezone offset is in the returned string.

Definition at line 25 of file datetime.cpp.

QString DateTime::toPathFriendlyUTCISO8601 ( const QDateTime &  datetime)
static

Format QDateTime in the almost-ISO 8601 format with UTC timezone.

Produce a formatted datetime that can be used as a path name.

  • The QDateTime is converted to UTC.
  • The date is saved in the expanded ISO 8601 format.
  • The time is saved in the basic ISO 8601 format to avoid :.

The output format is YYYY-MM-DDThhmmssZ.

This is meant to produce a datetime that is readable, doesn't use characters that may collide with filesystem rules (: is used to delimit $PATH), sorts naturally in chronological order, and... pretends to be ISO 8601, while its not.

One could argue that the basic ISO 8601 format (YYYYMMDDThhmmssZ) would be sufficient here, but that's not readable.

Definition at line 31 of file datetime.cpp.


The documentation for this class was generated from the following files: