// 毫秒级
qint64 timestamp = QDateTime::currentMSecsSinceEpoch();
//秒级
qint64 timestamp = QDateTime::currentSecsSinceEpoch()
//秒级
time(NULL)
// 时间戳转时间
QDateTime time2 = QDateTime::fromTime_t(QDateTime::currentSecsSinceEpoch());
qDebug() << time2; // QDateTime(2022-02-23 09:03:41.000 HKT Qt::LocalTime)
附注
时间戳处理网站
https://tool.chinaz.com/tools/unixtime.aspx