title: Convert string of YYYYMMDD to YYYY-MM-DD Date format in Snowflake
body: <p>Based on the example mentioned here in the Snowflake <a href="https://docs.snowflake.com/en/sql-reference/functions/to_date.html" rel="nofollow noreferrer">documentation</a>, why are the date and timestamp values returning different values just by changing the ORDER BY clause? Also, I am trying to convert a string to a date format which is not returning correct results in Snowflake while this works fine in other SQL based Engines. Need help from experts on this.</p>
  <p>This query</p>
  <pre><code>SELECT '20200710', TO_DATE('20200710');
  </code></pre>
  <p>is returning the following output</p>
  <blockquote>
  <p>20200710 | 1970-08-22</p>
  </blockquote>
  <p>Also tried:</p>
  <pre><code>SELECT TO_DATE('20200710', 'YYYY-MM-DD');
  </code></pre>
  <p>and got the error:</p>
  <blockquote>
  <p>Can't parse '20200710' as date with format 'YYYY-MM-DD'</p>
  </blockquote>