private object DeserializeStringIntoDateTime() { // DivDiv 41127: Never confuse atlas serialized strings with dates. // DevDiv 74430: JavasciptSerializer will need to handle date time offset - following WCF design // serialized dates look like: "\/Date(123)\/" or "\/Date(123A)" or "Date(123+4567)" or Date(123-4567)" // the A, +14567, -4567 portion in the above example is ignored int pos = _s.IndexOf(DateTimeSuffix); Match match = Regex.Match(_s.Substring(pos + DateTimeSuffixLength), @"^""\\/Date\((?<ticks>-?[0-9]+)(?:[a-zA-Z]|(?:\+|-)[0-9]{4})?\)\\/"""); string ticksStr = match.Groups["ticks"].Value; long ticks; if (long.TryParse(ticksStr, out ticks)) { _s.MoveNext(match.Length); // The javascript ticks start from 1/1/1970 but FX DateTime ticks start from 1/1/0001 DateTime dt = new DateTime(ticks * 10000 + JavaScriptSerializer.DatetimeMinTimeTicks, DateTimeKind.Utc); return(dt); } else { // If we failed to get a DateTime, treat it as a string return(DeserializeString()); } }