我有代表1579106713
的unixtimestamp 1/15/2020 16:45:13
,我这次需要在Qt中进行转换,我使用了代码但是得到了不同的值
int unixTimeTmp = 1579106713; // 1/15/2020 16:45:13
QDateTime timestampq;
timestampq.setTime_t(unixTimeTmp);
qDebug() << timestampq.toString();
提供输出
Wed Jan 15 11:45:13 2020 // expect Wed Jan 15 16:15:33 2020
[当我在这里检查https://www.epochconverter.com时,我已经看到必须获取GMT输出,但是不知道如何使用Qt来获得
int unixTimeTmp = 1579106713; // 1/15/2020 16:45:13
QDateTime timestampq;
timestampq.setTime_t(unixTimeTmp);
timestampq.setTimeSpec(Qt::UTC);
qDebug() << timestampq.toString();
return 1;