title: Casting String type to Unix Date Amazon Athena
body: <p>I'm looking to get a result in Amazon Athena were I can count the quantity of users created by day (or maybe by month)</p>
  
  <p>But previous that I have to convert the unix timestamp to another date format. And this is where i fail. </p>
  
  <p>My last goal is to convert this type of timestamp:</p>
  
  <blockquote>
    <p>1531888605109</p>
  </blockquote>
  
  <p>In something like:</p>
  
  <blockquote>
    <p>2018-07-18</p>
  </blockquote>
  
  <p><a href="https://www.epochconverter.com/" rel="nofollow noreferrer">According to Epoch Converter</a></p>
  
  <p>But when I try to apply the solution i saw in this quiestion: <a href="https://stackoverflow.com/questions/44420926/casting-unix-time-to-date-in-presto">Casting unix time to date in Presto</a></p>
  
  <p>I got the error:</p>
  
  <blockquote>
    <p>[Simba]AthenaJDBC An error has been thrown from the AWS Athena client. SYNTAX_ERROR: line 1:13: Unexpected parameters (varchar) for function from_unixtime. Expected: from_unixtime(double) , from_unixtime(double, bigint, bigint) , from_unixtime(double, varchar(x)) [SQL State=HY000, DB Errorcode=100071]</p>
  </blockquote>
  
  <p>This is my query:</p>
  
  <pre><code>select   cast(from_unixtime(created)as date) as date_creation, 
           count(created) 
  from     datalake.test
  group by date_creation
  </code></pre>
  
  <p>Maybe I've to cast over the sctring because the data type of the field is not a date.</p>
  
  <p>My table description: <a href="https://imgur.com/a/0f7PB7N" rel="nofollow noreferrer">Link to the table description</a></p>