Returns the string containing the specified date and time value in the IMAP4 format.
The IMAP4 datetime string in "dd-MMM-yyyy HH:mm:ss +/-HHmm", "dd-MMM-yyyy HH:mm:ss", or "dd-MMM-yyyy" format.
When uploading messages with UploadMessage method, the datetime value can contain all 3 fields (date, time, and timezone). When searching messages with Search method, datetime values can contain only date field.
This sample prints certain DateTime value as IMAP4-formatted string.
[C#] using System; using MailBee; using MailBee.ImapMail; class Sample { static void Main(string[] args) { // Assume it's 8 Apr 2006 14:45:50 (24 hrs clock) now, // and the local timezone is EDT (UTC minus 4 hrs 0 mins). DateTime dt = DateTime.Now; Console.WriteLine(ImapUtils.GetImapDateTimeString(dt, true, "-0400")); // The output: 08-Apr-2006 14:45:50 -0400 Console.WriteLine(ImapUtils.GetImapDateTimeString(dt, false, "-0400")); // The output: 08-Apr-2006 Console.WriteLine(ImapUtils.GetImapDateTimeString(dt, true, null)); // The output: 08-Apr-2006 14:45:50 } }
[Visual Basic] Imports System Imports MailBee Imports MailBee.ImapMail Module Sample Sub Main(ByVal args As String()) ' Assume it's 8 Apr 2006 14:45:50 (24 hrs clock) now, ' and the local timezone is EDT (UTC minus 4 hrs 0 mins). Dim dt As DateTime = DateTime.Now Console.WriteLine(ImapUtils.GetImapDateTimeString(dt, True, "-0400")) ' The output: 08-Apr-2006 14:45:50 -0400 Console.WriteLine(ImapUtils.GetImapDateTimeString(dt, False, "-0400")) ' The output: 08-Apr-2006 Console.WriteLine(ImapUtils.GetImapDateTimeString(dt, True, CType(Nothing, String))) ' The output: 08-Apr-2006 14:45:50 End Sub End Module
ImapUtils Class | MailBee.ImapMail Namespace | ImapUtils.GetImapDateTimeString Overload List