ImapUtilsGetDateTimeFromImapDate Method
Converts the datetime string in IMAP4 format into DateTime value.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax
public static DateTime GetDateTimeFromImapDate(
	string dateTimeString
)

Parameters

dateTimeString
Type: SystemString
The datetime string in IMAP4 format (can contain: date; date and time; date, time, and timezone).

Return Value

Type: DateTime
The DateTime value representing the parsed IMA4 datetime string, or MinValue if the specified datetime string could not be parsed.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptiondateTimeString is a null reference (Nothing in Visual Basic).
Remarks
The returned date is in UTC (GMT) time. To convert it into local time, the developer can use ToLocalTime method.
Examples
This sample parses a few IMAP4 datetime strings into DateTime structures and prints the results as UTC time and local time.
using System;
using MailBee;
using MailBee.ImapMail;

class Sample
{
    static void Main(string[] args)
    {
        DateTime dt;
        string dtString;

        dtString = "08-Sep-2004 13:47:32 -0400";

        Console.WriteLine(dtString);
        dt = ImapUtils.GetDateTimeFromImapDate(dtString);
        Console.WriteLine("UTC time: " + dt);
        Console.WriteLine("Local time: " + dt.ToLocalTime());
        Console.WriteLine();

        dtString = "20-May-2005 00:47:32";

        Console.WriteLine(dtString);
        dt = ImapUtils.GetDateTimeFromImapDate(dtString);
        Console.WriteLine("UTC time: " + dt);
        Console.WriteLine("Local time: " + dt.ToLocalTime());
        Console.WriteLine();

        dtString = "31-Jan-2005";

        Console.WriteLine(dtString);
        dt = ImapUtils.GetDateTimeFromImapDate(dtString);
        Console.WriteLine("UTC time: " + dt);
        Console.WriteLine("Local time: " + dt.ToLocalTime());
    }
}
See Also