title: How to convert a date format YYYY-MM-DD into integer YYYYMMDD in Presto/Hive?
body: <p>How to <code>CONVERT</code> a date in format <code>YYYY-MM-DD</code> into integer <code>YYYYMMDD</code> in Presto/Hive? </p>
  
  <p>I am trying to convert the below list into <code>YYYYMMDD</code> integers</p>
  
  <pre><code>WITH  all_dates  as (SELECT
      CAST(date_column AS DATE) date_column
  FROM
      (VALUES
          (SEQUENCE(FROM_ISO8601_DATE('2017-07-01'),
                    FROM_ISO8601_DATE('2017-11-15'),
                    INTERVAL '1' DAY)
          )
      ) AS t1(date_array)
  CROSS JOIN
      UNNEST(date_array) AS t2(date_column)
      )
  </code></pre>
  
  <p>I tried something like this but it doesn't work</p>
  
  <pre><code>   SELECT
     CAST(
        CAST(year(date_column) AS VARCHAR(4)) +
        right('0' + CAST(month(date_column) AS VARCHAR(2)), 2) +
        right('0' + CAST(day(date_column) AS VARCHAR(2)), 2) 
     AS DATETIME)
     FROM all_dates
  </code></pre>