qt - Converting QString containing PostgreSQL timestamp to QDateTime -


i'm having trouble seemingly simple problem: want qdatetime qstring containing timestamp. got timestamp postgresql, doesn't matter. here code not work:

qstring timestamp = "2010-10-09 19:21:46+02:00"; qstring format = "yyyy-mm-dd hh:mm:sstzd"; qdatetime dt = qdatetime::fromstring(timestamp, format); qdebug() << dt.tostring(); // outputs empty string 

there must obvious i'm missing. thanks!

there 2 mistakes making. there no tzd in format specifications, removed time zone information since not need in app doing:

timestamp.chop(6); 

and used following format qdatetime. note lowercase format characters:

qdatetime createdat = qdatetime::fromstring(timestamp, "yyyy-mm-dd hh:mm:ss"); 

thanks above helping out.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -