- return new DateTime (1970, 1, 1).AddMilliseconds (long.Parse (s.Substring (6, s.Length - 8)));
+
+ // The date can contain [SIGN]LONG, [SIGN]LONG+HOURSMINUTES or [SIGN]LONG-HOURSMINUTES
+ // the format for HOURSMINUTES is DDDD
+ int tidx = s.IndexOf ('-', 8);
+ if (tidx == -1)
+ tidx = s.IndexOf ('+', 8);
+ int minutes = 0;
+ if (tidx == -1){
+ s = s.Substring (6, s.Length - 8);
+ } else {
+ int offset;
+ int.TryParse (s.Substring (tidx+1, s.Length-3-tidx), out offset);
+
+ minutes = (offset % 100) + (offset / 100) * 60;
+ if (s [tidx] == '-')
+ minutes = -minutes;
+
+ s = s.Substring (6, tidx-6);
+ }
+ var date = new DateTime (1970, 1, 1).AddMilliseconds (long.Parse (s));
+ if (minutes != 0)
+ date = date.AddMinutes (minutes);
+ return date;