1.把QString字符串转为时间戳
QString str1= 2022-02-03,str2= 20:02:03
QDate time1 = QDate::fromString(TestInfo->Date, "yyyy-MM-dd");
QTime time2 = QTime::fromString(TestInfo->Time, "HH:mm:ss");
2.获取系统时间
QString str3 = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
3.单独获取年月日,时分秒,返回int型
time1 .year();
time1.month();
time1.day();
time2.hour();
time2.minute();
time2.second();
3.增加时间
QDate::currentDate().addDays(2).toString("yyyy-MM-dd");
QTime::currentTime().addSecs(120).toString("hh:mm:ss");