mirror of
https://github.com/tnodir/fort
synced 2024-11-15 10:25:10 +00:00
UI: DateUtil: Fix converting a date to date-time.
This commit is contained in:
parent
6e0b300b95
commit
bfa9d41c01
@ -29,7 +29,7 @@ qint32 DateUtil::getUnixHour(qint64 unixTime)
|
||||
qint32 DateUtil::getUnixDay(qint64 unixTime)
|
||||
{
|
||||
const QDate date = QDateTime::fromSecsSinceEpoch(unixTime).date();
|
||||
const QDateTime dateTime = QDateTime(date, QTime(0, 0), Qt::UTC);
|
||||
const QDateTime dateTime = date.startOfDay(Qt::UTC);
|
||||
|
||||
return getUnixHour(dateTime.toSecsSinceEpoch());
|
||||
}
|
||||
@ -42,7 +42,7 @@ qint32 DateUtil::getUnixMonth(qint64 unixTime, int monthStart)
|
||||
}
|
||||
|
||||
const QDate dateMonth = QDate(date.year(), date.month(), 1);
|
||||
const QDateTime dateTime = QDateTime(dateMonth, QTime(0, 0), Qt::UTC);
|
||||
const QDateTime dateTime = dateMonth.startOfDay(Qt::UTC);
|
||||
|
||||
return getUnixHour(dateTime.toSecsSinceEpoch());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user