System.Net.FtpClient.FtpExtensions.GetFtpDate C# (CSharp) Method

GetFtpDate() public static method

Tries to convert the string FTP date representation into a date time object
public static GetFtpDate ( this date, DateTimeStyles style ) : System.DateTime
date this The date
style DateTimeStyles UTC/Local Time
return System.DateTime
        public static DateTime GetFtpDate(this string date, DateTimeStyles style)
        {
            string[] formats = new string[] {
                "yyyyMMddHHmmss",
                "yyyyMMddHHmmss.fff",
                "MMM dd  yyyy",
                "MMM dd HH:mm"
            };
            DateTime parsed;

            if (DateTime.TryParseExact(date, formats, CultureInfo.InvariantCulture, style, out parsed)) {
                return parsed;
            }

            return DateTime.MinValue;
        }