ImapUtilsGetImapDateTimeString Method (DateTime, Boolean, Boolean) |
Namespace: MailBee.ImapMail
When is true, the timezone part of the returned string will be "+0000"; otherwise, the local timezone in "+/-HHmm" format (such as "-0500" for EST). However, if includeTime is false, the time and timezone information will not be appended to the resulting string. "
When uploading messages with UploadMessage(MailMessage, String, String, String, Boolean, UidPlusResult) method, the datetime value can contain all 3 fields (date, time, and timezone). When searching messages with Search(Boolean, String, String) method, datetime values can contain only date field.
using System; using MailBee; using MailBee.ImapMail; class Sample { static void Main(string[] args) { // Assume it's 31-Dec-2005 20:00:00 (24 hrs clock) now, // and the local timezone is EST (UTC minus 5 hrs 0 mins). DateTime dtLocal = DateTime.Now; DateTime dtUtc = dtLocal.ToUniversalTime(); Console.WriteLine(ImapUtils.GetImapDateTimeString(dtLocal, true, false)); // The output: 31-Dec-2005 20:00:00 -0500 Console.WriteLine(ImapUtils.GetImapDateTimeString(dtUtc, true, true)); // The output: 01-Jan-2006 01:00:00 +0000 Console.WriteLine(ImapUtils.GetImapDateTimeString(dtLocal, false, false)); // The output: 31-Dec-2005 Console.WriteLine(ImapUtils.GetImapDateTimeString(dtUtc, false, true)); // The output: 01-Jan-2006 } }