QDateTime time1 = QDateTime::fromString("2018-03-19 16:40:02", "yyyy-MM-dd hh:mm:ss");
QDateTime time2 = QDateTime::fromString("2018-03-19 16:43:02", "yyyy-MM-dd hh:mm:ss");
qDebug() << "time2 - time1=" << time1.secsTo(time2);
这两个时间戳差了3分钟,结果输出就为 180,单位为秒