Time Zone / Offset

Dec 27, 2010 at 5:31 PM
I'm looking at MessageHeaderProcessor.cs and see this method. The regex knows to match the offset ([-]\d+), but doesn't capture or use it. 

Am I missing something? Is this the actual place in code where dates are parsed? 

        private DateTime ParseDate(string date)
            //Tue,  7 Apr 2009 09:04:02 -0700 (PDT)
            string pattern = @"^\w+[,]\s+(?<day>(\d+))\s+(?<month>(\w+))\s+(?<year>(\d+))\s+(?<hour>(\d{2})):(?<min>(\d{2})):(?<sec>(\d{2}))\s+[-]\d+\s+";
            Match match = Regex.Match(date, pattern);
            if (match.Success)
                int day = Int32.Parse(match.Groups["day"].Value);
                int month = GetMonth(match.Groups["month"].Value);
                if (month == 0)
                    throw new Exception("Could not identify month in date string");

                int year = Int32.Parse(match.Groups["year"].Value);
                int hour = Int32.Parse(match.Groups["hour"].Value);
                int min = Int32.Parse(match.Groups["min"].Value);
                int sec = Int32.Parse(match.Groups["sec"].Value);
                DateTime d = new DateTime(year, month, day, hour, min, sec);
                return d;


            DateTime d2 = new DateTime();
            DateTime.TryParse(date, out d2);

            return d2;