QDateTime now = QDateTime::currentDateTime(); QString nowStr; nowStr = now.toString("yyyyMMdd_hhmmss"); QString fName = QString("debug_%1.log") .arg(nowStr);