OGS
GetDateTime.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <QDateTime>
14#include <QString>
15#include <string>
16
18inline QDateTime getDateTime(QString const& stringDate)
19{
20 if (stringDate.length() == 10)
21 return QDateTime::fromString(stringDate, "dd.MM.yyyy");
22
23 if (stringDate.length() == 19)
24 return QDateTime::fromString(stringDate, "dd.MM.yyyy.HH.mm.ss");
25
26 return QDateTime();
27}
28
30inline QDateTime getDateTime(std::string const& stringDate)
31{
32 return getDateTime(QString::fromStdString(stringDate));
33}
QDateTime getDateTime(QString const &stringDate)
Converts string into QDateTime-format.
Definition GetDateTime.h:18