Results 1 to 3 of 3

Thread: How to get a vaild mail time GMT?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Posts
    788
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    49
    Thanked 48 Times in 46 Posts

    Default 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

    Qt Code:
    1. QStringList RTFdays = QStringList() << "foof" << "Mon" << "Tue" << "Wed" << "Thu" << "Fri" << "Sat" << "Sun";
    2. QStringList RTFmonth = QStringList() << "foof" << "Feb" << "Mar" << "Apr" << "May" << "Jun" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
    To copy to clipboard, switch view to plain text mode 




    Qt Code:
    1. int dateswap(QString form, uint unixtime )
    2. {
    3. QDateTime fromunix;
    4. fromunix.setTime_t(unixtime);
    5. QString numeric = fromunix.toString((const QString)form);
    6. bool ok;
    7. return (int)numeric.toFloat(&ok);
    8. }
    9.  
    10.  
    11. QString TimeStampMail()
    12. {
    13. /* mail rtf Date format! http://www.faqs.org/rfcs/rfc788.html */
    14. /* bybass qlocale Bug from window XP MUI */
    15. uint unixtime = (uint)time( NULL );
    16. QDateTime fromunix;
    17. fromunix.setTime_t(unixtime);
    18. QStringList RTFdays = QStringList() << "Mon" << "Tue" << "Wed" << "Thu" << "Fri" << "Sat" << "Sun";
    19. QStringList RTFmonth = QStringList() << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec";
    20. QDate timeroad(dateswap("yyyy",unixtime),dateswap("M",unixtime),dateswap("d",unixtime));
    21. /*qDebug() << "### RTFdays " << RTFdays.at(timeroad.dayOfWeek());
    22.   qDebug() << "### RTFmonth " << RTFmonth.at(dateswap("M",unixtime));
    23.   qDebug() << "### yyyy " << dateswap("yyyy",unixtime);
    24.   qDebug() << "### M " << dateswap("M",unixtime);
    25.   qDebug() << "### d " << dateswap("d",unixtime);*/
    26. QStringList rtfd_line;
    27. rtfd_line.clear();
    28. rtfd_line.append("Date: ");
    29. rtfd_line.append(RTFdays.at(timeroad.dayOfWeek()));
    30. rtfd_line.append(", ");
    31. rtfd_line.append(QString::number(dateswap("d",unixtime)));
    32. rtfd_line.append(" ");
    33. rtfd_line.append(RTFmonth.at(dateswap("M",unixtime)));
    34. rtfd_line.append(" ");
    35. rtfd_line.append(QString::number(dateswap("yyyy",unixtime)));
    36. rtfd_line.append(" ");
    37. rtfd_line.append(fromunix.toString("hh:mm:ss"));
    38. rtfd_line.append(" -0000");
    39. /*qDebug() << "### mail rtf Date format " << rtfd_line.join("");*/
    40. return QString(rtfd_line.join(""));
    41.  
    42. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by patrik08; 31st May 2006 at 21:43.

Similar Threads

  1. Opening the default mail client
    By munna in forum Newbie
    Replies: 5
    Last Post: 3rd April 2006, 13:58
  2. Replies: 6
    Last Post: 17th March 2006, 17:48
  3. Did you people get the unsolicited mail? - "Release of Makedoc"
    By jamadagni in forum General Discussion
    Replies: 5
    Last Post: 14th February 2006, 12:46
  4. Compiling time changes, and how!
    By GreyGeek in forum Qt Programming
    Replies: 2
    Last Post: 2nd February 2006, 13:19
  5. Problem with pointers while using localtime() and time()
    By jamadagni in forum General Programming
    Replies: 7
    Last Post: 11th January 2006, 15:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.