mirror of
https://github.com/hasherezade/pe-bear
synced 2026-06-08 14:34:04 +00:00
c56ac5b2cc
- This does compile and run on Qt 6 - Tried not to break Qt 4
20 lines
469 B
C++
20 lines
469 B
C++
#include "DateDisplay.h"
|
|
|
|
#include <time.h>
|
|
|
|
QString getDateString(const quint64 timestamp)
|
|
{
|
|
if (timestamp == 0 || timestamp == (-1)) {
|
|
return "";
|
|
}
|
|
const time_t rawtime = (const time_t)timestamp;
|
|
QString format = "dddd, dd.MM.yyyy hh:mm:ss";
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
QDateTime date1(QDateTime::fromSecsSinceEpoch(rawtime));
|
|
#else
|
|
QDateTime date1(QDateTime::fromTime_t(rawtime));
|
|
#endif
|
|
return date1.toUTC().toString(format) + " UTC";
|
|
}
|
|
|