OPL::DateTime Class Reference

## Static Public Member Functions

static QString | dateToString (const QDate &date, OPL::DateFormat format=OPL::DateFormat::ISODate)
| Reimplements QDate::toString to accept OPL::Date::DateFormat enums.
static QDate | parseInput (QString &user_input, OPL::DateFormat format)
| takes a user-provided input and tries to convert it to a (valid) QDate. More...
static void | tryToFix (QString &user_input, OPL::DateFormat format)
static void | padCentury (QString &io_user_input, OPL::DateFormat format)
| padCentury adds the century to a date where it was omitted
static void | padZeroes (QString &io_user_input)
| pads a user-provided date string with 0s to facilitate conversion to QDate
static void | addSeperators (QString &io_user_input, const OPL::DateFormat &format)
static bool | containsSeperator (const QString &user_input)
static const QStringList & | getDisplayNames ()
static const QString | getFormatString (OPL::DateFormat format)
static const QString | currentDate ()
| today Returns a string containing the current date in ISO format More...
static const QString | dateTimeToString (const QDateTime &date_time, OPL::DateTimeFormat format)
| dateTimeToString formats a QDateTime object into a string in a uniform way. More...
static QDateTime | fromString (const QString &date_time_string)

## Static Public Attributes

static const QString | ISO_FORMAT_STRING = QStringLiteral("yyyy-MM-dd")
static const QString | DE_FORMAT_STRING = QStringLiteral("dd.MM.yyyy")
static const QString | EN_FORMAT_STRING = QStringLiteral("MM/dd/yyyy")
static const QMap< OPL::DateFormat, QString > | DATEFORMATSMAP
static const QStringList | DISPLAY_NAMES

## Member Function Documentation

## currentDate()

const QString OPL::DateTime::currentDate | ( |  | ) |

static

today Returns a string containing the current date in ISO format

Returns

## dateTimeToString()

static const QString OPL::DateTime::dateTimeToString | ( | const QDateTime & | date_time,
|  | OPL::DateTimeFormat | format
| ) |  |

inlinestatic

dateTimeToString formats a QDateTime object into a string in a uniform way.

Returns

## parseInput()

QDate OPL::DateTime::parseInput | ( | QString & | user_input,
|  | OPL::DateFormat | format
| ) |  |

static

takes a user-provided input and tries to convert it to a (valid) QDate.

Returns
  QDate (invalid if input not recognized)

## Member Data Documentation

## DATEFORMATSMAP

const QMap<OPL::DateFormat, QString> OPL::DateTime::DATEFORMATSMAP

inlinestatic

Initial value:
= {
{OPL::DateFormat::ISODate, ISO_FORMAT_STRING},
{OPL::DateFormat::DE, DE_FORMAT_STRING },
{OPL::DateFormat::EN, EN_FORMAT_STRING },
}

## DISPLAY_NAMES

const QStringList OPL::DateTime::DISPLAY_NAMES

inlinestatic

Initial value:
= {
QStringLiteral("ISO 8601: yyyy-MM-dd"),
QStringLiteral("DE: dd.MM.yyyy"),
QStringLiteral("EN: MM/dd/yyyy")
}

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

- src/functions/datetime.h
- src/functions/datetime.cpp