QDateTime转换为QString

QDateTime转换为QString


QDateTime time =QDateTime::currentDateTime();

QString sda_name="E:/"+chrom_mac+time.toString("yyyyMMddhhmmss")+".sda";


time.toString("yyyyMMddhhmmss")将time转化成了string类型,格式为"yyyyMMddhhmmss"


QString转换为QDateTime

QString str = "2016-05-30 12:35:00"
QDateTime time= QDateTime::fromString(str, "yyyy-MM-dd hh:mm:ss");

QString str = "2016-05-30 12:35:00"; 
QDateTime time= QDateTime::fromString(str, "yyyy-MM-dd hh:mm:ss"); 


QString strBuffer;  QDateTimeQDateTime::fromString ( const QString & string,const QString & format)


你可能感兴趣的:(QT)