2017-12-06 13:40:58 +00:00
|
|
|
#ifndef DATEUTIL_H
|
|
|
|
#define DATEUTIL_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2017-12-06 14:43:33 +00:00
|
|
|
#include <QString>
|
2017-12-06 13:40:58 +00:00
|
|
|
|
|
|
|
class DateUtil : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit DateUtil(QObject *parent = nullptr);
|
|
|
|
|
|
|
|
static qint64 getUnixTime();
|
|
|
|
static qint64 toUnixTime(qint32 unixHour);
|
|
|
|
|
|
|
|
static qint32 getUnixHour(qint64 unixTime);
|
|
|
|
static qint32 getUnixDay(qint64 unixTime);
|
|
|
|
static qint32 getUnixMonth(qint64 unixTime);
|
2017-12-06 14:43:33 +00:00
|
|
|
|
|
|
|
static qint32 addUnixMonths(qint32 unixHour, int months);
|
|
|
|
|
|
|
|
static QString formatTime(qint64 unixTime);
|
|
|
|
static QString formatHour(qint64 unixTime);
|
|
|
|
static QString formatDay(qint64 unixTime);
|
|
|
|
static QString formatMonth(qint64 unixTime);
|
|
|
|
|
|
|
|
static QString formatDateTime(qint64 unixTime, const QString &format);
|
2017-12-06 13:40:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DATEUTIL_H
|