rem:  var parts = dateString.match(/(\d\d\d\d)(-(\d\d))?(-(\d\d))?(T(\d\d):(\d\d)(:(\d\d)(\.(\d+))?)?(Z|([+-])(\d\d):(\d\d))?)?/);                             var date = new Date(parts[1], parts[3] - 1, parts[5], parts[7] || 0, parts[8] || 0, parts[10] || 0, parts[12] || 0);                          var remoteToUTCOffset = 0; if (parts[13] && parts[13] != "Z") { var direction = (parts[14] == "+" ? 1 : -1); if (parts[15]) remoteToUTCOffset += direction * parts[15] * HOURS_TO_MILLISECONDS; if (parts[16]) remoteToUTCOffset += direction * parts[16] * MINUTES_TO_MILLISECONDS; } remoteToUTCOffset = remoteToUTCOffset * -1;   var UTCToLocalOffset = date.getTimezoneOffset() * MINUTES_TO_MILLISECONDS; UTCToLocalOffset = UTCToLocalOffset * -1; date.setTime(date.getTime() + remoteToUTCOffset + UTCToLocalOffset);  
add: var date = ISO8601DateUtils.parse(dateString); 
context: function W3CToIETFDate(dateString) {  var parts = dateString.match(/(\d\d\d\d)(-(\d\d))?(-(\d\d))?(T(\d\d):(\d\d)(:(\d\d)(\.(\d+))?)?(Z|([+-])(\d\d):(\d\d))?)?/);  // Here's an example of a W3C-DTF date string and what .match returns for it.  //   // date: 2003-05-30T11:18:50.345-08:00  // date.match returns array values:  //  //   0: 2003-05-30T11:18:50-08:00,  //   1: 2003,  //   2: -05,  //   3: 05,  //   4: -30,  //   5: 30,  //   6: T11:18:50-08:00,  //   7: 11,  //   8: 18,  //   9: :50,  //   10: 50,  //   11: .345,  //   12: 345,  //   13: -08:00,  //   14: -,  //   15: 08,  //   16: 00  // Create a Date object from the date parts.  Note that the Date  // object apparently can't deal with empty string parameters in lieu  // of numbers, so optional values (like hours, minutes, seconds, and  // milliseconds) must be forced to be numbers.  var date = new Date(parts[1], parts[3] - 1, parts[5], parts[7] || 0,                      parts[8] || 0, parts[10] || 0, parts[12] || 0);  // We now have a value that the Date object thinks is in the local  // timezone but which actually represents the date/time in the  // remote timezone (f.e. the value was "10:00 EST", and we have  // converted it to "10:00 PST" instead of "07:00 PST").  We need to  // correct that.  To do so, we're going to add the offset between  // the remote timezone and UTC (to convert the value to UTC), then  // add the offset between UTC and the local timezone //(to convert  // the value to the local timezone).  // Ironically, W3C-DTF gives us the offset between UTC and the  // remote timezone rather than the other way around, while the  // getTimezoneOffset() method of a Date object gives us the offset  // between the local timezone and UTC rather than the other way  // around.  Both of these are the additive inverse (i.e. -x for x)  // of what we want, so we have to invert them to use them by  // multipying by -1 (f.e. if "the offset between UTC and the remote  // timezone" is -5 hours, then "the offset between the remote  // timezone and UTC" is -5*-1 = 5 hours).  // Note that if the timezone portion of the date/time string is  // absent (which violates W3C-DTF, although ISO 8601 allows it), we  // assume the value to be in UTC.  // The offset between the remote timezone and UTC in milliseconds.  var remoteToUTCOffset = 0;  if (parts[13] && parts[13] != "Z") {    var direction = (parts[14] == "+" ? 1 : -1);    if (parts[15])      remoteToUTCOffset += direction * parts[15] * HOURS_TO_MILLISECONDS;    if (parts[16])      remoteToUTCOffset += direction * parts[16] * MINUTES_TO_MILLISECONDS;  }  remoteToUTCOffset = remoteToUTCOffset * -1; // invert it  // The offset between UTC and the local timezone in milliseconds.  var UTCToLocalOffset = date.getTimezoneOffset() * MINUTES_TO_MILLISECONDS;  UTCToLocalOffset = UTCToLocalOffset * -1; // invert it  date.setTime(date.getTime() + remoteToUTCOffset + UTCToLocalOffset);  return date.toUTCString();}
meta: 10520	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/10520/10b4049d88c735305dcc9e64b48008a4289f1459/FeedProcessor.js/clean/toolkit/components/feeds/src/FeedProcessor.js