title: What datatype to use for ISO 8601 dates?
body: <p>I am redesigning a database that currently imports ISO 8601 dates in the format of <code>2012-10-27T07:30:38+00:00</code> into a varchar field. The current database is hosted on a MySQL 5.5 server. </p>
  
  <p>In searching through documentation and various SO posts, I have not found a definitive answer on what datatype I should use in MySQL for this purpose. The closest post is:  <a href="https://stackoverflow.com/questions/11053941/mysql-insert-to-datetime-is-it-safe-to-use-iso8601-format">MySQL insert to DATETIME: is it safe to use ISO::8601 format?</a> where it provides a work around of sorts, however this is not a desirable option.</p>
  
  <p>The MySQL documentation (<a href="http://dev.mysql.com/doc/refman/5.5/en/date-and-time-types.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.5/en/date-and-time-types.html</a>) does not say, and the only reference I can find on official documentation is located on page: <a href="http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html</a></p>
  
  <p>which states "The possible values for the first and second arguments result in several possible format strings (for the specifiers used, see the table in the DATE_FORMAT() function description). ISO format refers to ISO 9075, not ISO 8601."</p>
  
  <p>Now the PostgreSQL documentation specifically mentions ISO8601 ( <a href="http://www.postgresql.org/docs/9.2/static/datetime-keywords.html" rel="noreferrer">http://www.postgresql.org/docs/9.2/static/datetime-keywords.html</a> and <a href="http://www.postgresql.org/docs/9.2/static/datatype-datetime.html" rel="noreferrer">http://www.postgresql.org/docs/9.2/static/datatype-datetime.html</a> ) which leads me to my  question: </p>
  
  <p><strong>Does MySQL correctly support ISO 8601, or should I consider a database with native support?</strong> </p>
  
  <p>--Edit--</p>
  
  <p>Attempting to insert the example time stamp above into a datetime column gives the following error: </p>
  
  <pre><code>10:55:55    insert into test(date1) values('2012-10-27T07:30:38+00:00') Error Code: 1292. Incorrect datetime value: '2012-10-27T07:30:38+00:00' for column 'date1' at row 1 0.047 sec
  </code></pre>