我在将QDate转换为QString时遇到了问题。请参见以下代码:
cout << QString("\nBooking Date: %1").arg(QDate::toString(this->getBookingDate() &YYYY.mm.dd)当我尝试编译这段代码时,它给了我:
‘YYYY’ was not declared in this scope然而,文档中说:
“以字符串形式返回日期。format参数确定结果字符串的格式...”并继续列出格式字符串。
我是Qt的新手,所以如果我错过了显而易见的东西,请原谅我的无知。
发布于 2012-03-16 03:09:41
你想要this->getBookingDate().toString("yyyy.MM.dd")。有关更多信息,请阅读documentation。
发布于 2018-10-02 22:06:59
在PySide2中,您可以使用以下命令:
self.dateEdit.date().toString("yyyy.MM.dd")https://stackoverflow.com/questions/9726430
复制相似问题