qt - QDateTime Conversion -
i need convert string variable qdatetime format my code looks qstring date ="thu jun 18 2015"; qdatetime tmp = qdatetime::fromstring(date,"ddd mmm dd yyyy hh:mm:ss"); but result thu jan 1 00:00:00 1970 . later have convert date in foramt yyyy-mm-dd hh:mm:ss , first step have convert string in qdatetime have convert final format, there mistake above code? any appreciated. thanks haris your date string not include time, while mentioned want one, fail @ least in qt 5.4 . don't know though why epoche outputed, maybe dependant on qt version. your date format locale dependent . see example doucmentation "ddd" in qdatetime::fromstring : the abbreviated localized day name (e.g. 'mon' 'sun'). uses qdate::shortdayname(). which unfortunately not clear, while more clear qdatetime::tostring : the abbreviated localized day name (e.g. 'mon' 'sun'). uses system locale localize name, i.e. qlocal...