QDateTime GMT add sec. or - sec. from locale time....
The server send my a date format evry time on GMT null format... Greenw...
"Wed, 07 Feb 2007 18:44:19 GMT"
to append one one H i make so...
dateTime2.addSecs(3600); /* by hand ....*/
but how i can discovery a calculable local date.... +1 or -1
muss i build a switsch for evry 24 world H. time....
I like Unix time format to display human readable time and to see diff from localfile lastmod time.... (QFileInfo)
Code:
/* grab remote server gmt time to check localfile lastmod update or not */
uint MailTimeString
( QString indate
)
{
/* incomming format Wed, 07 Feb 2007 18:44:19 GMT*/
/* or mail rtf Date format! http://www.faqs.org/rfcs/rfc788.html */
indate.replace("Date:","");
indate.trimmed();
if (sdate.size() != 6) {
return QTime_Null(); /* time current uint format */
}
sdate.removeFirst();
sdate.removeLast();
QString reformat
= sdate.
join(" ");
QDateTime dateTime3
= dateTime2.
addSecs(3600);
/* GMT +1 switzerland */
QLocale::system();
/* on comment out time is bad */
return dateTime3.toTime_t();
}
Re: QDateTime GMT add sec. or - sec. from locale time....
I must admit that I have not 100% understood you question.
But If you would like to convert a GMT datetime to a local datetime:
Code:
QDateTime gmtDateTime
= parseDateTime
(XXXXX
);
gmtDateTime.setTimeSpec(Qt::UTC);
QDateTime localDateTime
= gmtDateTime.
toLocalTime();
Re: QDateTime GMT add sec. or - sec. from locale time....
Oh.... yes only this simple "Qt::UTC" && .toLocalTime(); solve the date problem.... Tanks... :)