views:

170

answers:

2

hello all i have unix timestamp and i need to convert it to Human readable data + time
how can it be done in QT ?

+1  A: 

QDateTime.setTime_t

Matthew Flaschen
+2  A: 
int unixTime = 1234567890;
QDateTime timestamp;
timestamp.setTime_t(unixTime);
qDebug() << timestamp.toString(Qt::SystemLocaleShortDate);

That should get you going. Like Matthew said, see QDateTime.setTime_t, as well as QDateTime.toString. The toString has an enumeration with several different options, as well as an overload where you can pass a string allowing however much customization you like.

Jake Petroules