mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:25:18 +00:00
UI: StatisticsPage: Tweak date formats.
This commit is contained in:
parent
0ba14268ff
commit
c0838882d7
@ -97,7 +97,7 @@ BasePage {
|
||||
id: ipListView
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 4
|
||||
spacing: 5
|
||||
|
||||
model: ipListModel
|
||||
|
||||
|
@ -192,7 +192,7 @@ BasePage {
|
||||
id: trafListView
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 4
|
||||
spacing: 5
|
||||
clip: true
|
||||
|
||||
model: trafListModel
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "dateutil.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QLocale>
|
||||
|
||||
DateUtil::DateUtil(QObject *parent) :
|
||||
QObject(parent)
|
||||
@ -48,25 +49,26 @@ qint32 DateUtil::addUnixMonths(qint32 unixHour, int months)
|
||||
|
||||
QString DateUtil::formatTime(qint64 unixTime)
|
||||
{
|
||||
return formatDateTime(unixTime, "yyyy-MM-dd hh:mm:ss");
|
||||
return formatDateTime(unixTime, "dd-MMM-yyyy hh:mm:ss");
|
||||
}
|
||||
|
||||
QString DateUtil::formatHour(qint64 unixTime)
|
||||
{
|
||||
return formatDateTime(unixTime, "yyyy-MM-dd hh:00");
|
||||
return formatDateTime(unixTime, "dd-MMM-yyyy hh:00");
|
||||
}
|
||||
|
||||
QString DateUtil::formatDay(qint64 unixTime)
|
||||
{
|
||||
return formatDateTime(unixTime, "yyyy-MM-dd");
|
||||
return formatDateTime(unixTime, "dd MMMM yyyy");
|
||||
}
|
||||
|
||||
QString DateUtil::formatMonth(qint64 unixTime)
|
||||
{
|
||||
return formatDateTime(unixTime, "yyyy-MM");
|
||||
return formatDateTime(unixTime, "MMMM yyyy");
|
||||
}
|
||||
|
||||
QString DateUtil::formatDateTime(qint64 unixTime, const QString &format)
|
||||
{
|
||||
return QDateTime::fromSecsSinceEpoch(unixTime).toString(format);
|
||||
const QDateTime dt = QDateTime::fromSecsSinceEpoch(unixTime);
|
||||
return QLocale().toString(dt, format);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user