PDA

View Full Version : QDate without additional character



raphaelf
16th February 2006, 09:08
Hello everybody,

OS: WinXP
Compiler: MINGW
QT: 3.4

I save the current Datetime in a String variable:


QDateTime dt = QDateTime::currentDateTime();
QString datum = dt.toString();

My Result: "Do 16. Feb 10:00:59 2006"

I have to remove all "." and ":" from my String. I had a look in the QString class and i found a lot of functions and examples, but not for my case.
Could somebody help me to open my mind?

thanks ;)

raphaelf
16th February 2006, 09:41
Hi,

I could solve it ;)



QDateTime dt = QDateTime::currentDateTime();
QString datum = dt.toString();

datum.replace( ".", " " );
datum.replace( ":", " " );


thx

yop
17th February 2006, 21:16
QDateTime dt = QDateTime::currentDateTime();
QString datum = dt.toString("ddd dd MMM hh mm ss yyyy");Everything is in the docs did you bother reading them?