title: Converting from globalized date/time format (maybe ISO8601) to SQL Server datetime type
body: <p>Is there a string format to represent a datetime that SQL will be able to parse and convert into another offset (EST -> UTC for example).</p>
  
  <p>I have a string from the user such as:</p>
  
  <pre><code>declare @p1 varchar(50);
  declare @utcDateTime datetime;
  
  set @p1 = "2009-06-26 14:30:00.000Z-4:00";   -- could be ISO8601
  
  -- what do I do here to convert @p1?
  
  set @utcDateTime = -- should be "2009-06-26 18:30:00.000"
  </code></pre>
  
  <p>I want to be able to convert the string to its UTC equivalent and store it in a datetime field.  Such that:</p>
  
  <pre><code>select @ utcDateTime 
  </code></pre>
  
  <p>should yield this:</p>
  
  <pre><code>"2009-06-26 18:30:00.000"
  </code></pre>
  
  <p>In other words, I want to store a datetime that has the value of '2009-06-26 18:30', given the first string. </p>
  
  <p>Also, we must assume the server is not in the same timezone as the user (so we can't just detect the offset datediff(gettime(), getutctime()).</p>
  
  <p>I have tried using convert(...) and cast(... as datetime) but with no luck.</p>
  
  <p>Is there a way to do this in SQL Server 2005?  </p>