Converting Unix Time given in string to QDateTime
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
Article
Keywords: QDateTime
Created: vineet.jain
(15 Dec 2011)
Last edited: hamishwillee
(11 Oct 2012)
Headers required
#include <QDateTime>Source
Postconditions
The unix time value got successfully converted to : 07 Dec 2011 16:30:00


Vineet.jain - Compatibility
Though i have tested it using Nokia Qt SDK 1.1.3 & on devices N9/N950, but i am pretty sure that this code snippet is compatible with previous Qt SDK versions & platforms as well.
Thanks
Vineetvineet.jain 11:55, 15 December 2011 (EET)
Hamishwillee - Nice
Hi Vineet
Thanks for clarification. I've added "|platform=Qt, All versions" to capture the compatibility with Symbian and MeeGo.
Two notes for your future articles:
Regards
Hamishhamishwillee 02:03, 16 December 2011 (EET)