×
Namespaces

Variants
Actions
Revision as of 04:16, 11 October 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Converting Unix Time given in string to QDateTime

From Nokia Developer Wiki
Jump to: navigation, search

The code snippet shows how we can convert a unix time value stored in a QString to a corresponding value in QDateTime.

Article Metadata
Tested with
SDK: Nokia Qt SDK 1.1.3
Devices(s): N9, N950
Compatibility
Platform(s): Qt, all versions
Symbian
Article
Keywords: QDateTime
Created: vineet.jain (15 Dec 2011)
Last edited: hamishwillee (11 Oct 2012)

Headers required

#include <QDateTime>

Source

bool isconverted;
QString iUnixTimeValue = "1323275400"
uint iunixtime_integer = iUnixTimeValue .toUInt(&isconverted);
QDateTime idatetime = QDateTime::fromTime_t(iunixtime_integer );

Postconditions

The unix time value got successfully converted to : 07 Dec 2011 16:30:00

This page was last modified on 11 October 2012, at 04:16.
50 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×