6

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.

nick
  • 643
  • 1
  • 5
  • 11

2 Answers2

9

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

pnezis
  • 12,023
  • 2
  • 38
  • 38
  • Yes, your method works fine (+1). But i made a typo in question. Now edited. Sorry. – nick Jan 16 '12 at 17:26
0
QString DataList[100][100] ;
QDateTime AwbDateTime ;
AwbDateTime = QDateTime::fromString(DataList[i][9].left(19),Qt::ISODate) ; 

This will work fine in Qt3

Haytem BrB
  • 1,528
  • 3
  • 16
  • 23