How to get a vaild mail time GMT?
How to get a vaild mail time +0200 GMT or so....
and not local LANG month day letter?
this return Date: lun, 28 feb 2006 11:06:17 +0200 italian LANG...
Code:
{
/* Date: Mon, 08 May 2006 17:57:52 +0200 */
/* Date: Sun, 28 May 2006 06:32:25 -0420 */
QString day_en
= timecute.
shortDayName(timecute.
day());
QString month_en
= timecute.
shortMonthName (timecute.
month());
QString last
= dt.
toString("yyyy hh:mm:ss");
QString maildate
= QString( "Date: %1, %2 %3 %4 +0200" ).
arg( day_en ,
QString::number(timecute.
day()), month_en , last
);
return maildate;
}
Re: How to get a vaild mail time GMT?
Please search the forum before you ask a question --- somebody had the same problem not so long ago. AFAIR you must switch locale to C or hardcode the month and day names.
Re: How to get a vaild mail time GMT? rfc788
OK this work on different mail client ....
mail rtf Date format! http://www.faqs.org/rfcs/rfc788.html
insert foof day 0 zero/null
Code:
QStringList RTFmonth
= QStringList() <<
"foof" <<
"Feb" <<
"Mar" <<
"Apr" <<
"May" <<
"Jun" <<
"Jul" <<
"Aug" <<
"Sep" <<
"Oct" <<
"Nov" <<
"Dec";
Code:
int dateswap
(QString form, uint unixtime
) {
fromunix.setTime_t(unixtime);
bool ok;
return (int)numeric.toFloat(&ok);
}
{
/* mail rtf Date format! http://www.faqs.org/rfcs/rfc788.html */
/* bybass qlocale Bug from window XP MUI */
uint unixtime = (uint)time( NULL );
fromunix.setTime_t(unixtime);
QStringList RTFmonth
= QStringList() <<
"Jan" <<
"Feb" <<
"Mar" <<
"Apr" <<
"May" <<
"Jun" <<
"Jul" <<
"Aug" <<
"Sep" <<
"Oct" <<
"Nov" <<
"Dec";
QDate timeroad
(dateswap
("yyyy",unixtime
),dateswap
("M",unixtime
),dateswap
("d",unixtime
));
/*qDebug() << "### RTFdays " << RTFdays.at(timeroad.dayOfWeek());
qDebug() << "### RTFmonth " << RTFmonth.at(dateswap("M",unixtime));
qDebug() << "### yyyy " << dateswap("yyyy",unixtime);
qDebug() << "### M " << dateswap("M",unixtime);
qDebug() << "### d " << dateswap("d",unixtime);*/
rtfd_line.clear();
rtfd_line.append("Date: ");
rtfd_line.append(RTFdays.at(timeroad.dayOfWeek()));
rtfd_line.append(", ");
rtfd_line.
append(QString::number(dateswap
("d",unixtime
)));
rtfd_line.append(" ");
rtfd_line.append(RTFmonth.at(dateswap("M",unixtime)));
rtfd_line.append(" ");
rtfd_line.
append(QString::number(dateswap
("yyyy",unixtime
)));
rtfd_line.append(" ");
rtfd_line.append(fromunix.toString("hh:mm:ss"));
rtfd_line.append(" -0000");
/*qDebug() << "### mail rtf Date format " << rtfd_line.join("");*/
return QString(rtfd_line.
join(""));
}