Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QDateTime to QString with milliseconds in Qt3

Is there a way in Qt3 to convert QDateTime into a QString and back to QDateTime, so that eventually QDateTime will contain information about milliseconds?

Thanks.

like image 928
nick Avatar asked Jan 16 '12 16:01

nick


1 Answers

Use the toString function. The format parameter determines the format of the result string.

For example the following code will return only the seconds and the miliseconds.

QDateTime t = QDateTime::currentDateTime ();
QString s = t.toString("ss:zzz");

PS. You should consider porting your code to Qt4

like image 90
pnezis Avatar answered Sep 24 '22 06:09

pnezis