title: Casting date to int
body: <p>Please help me get past this:</p>
  
  <p>In MySQL, why does this work:</p>
  
  
  
  <pre class="lang-sql prettyprint-override"><code>CAST(FROM_UNIXTIME(`STG_users`.`lastlogindate`/1000,'%Y%m%d') AS UNSIGNED)
  </code></pre>
  
  <p>(where <code>STG_users.lastlogindate</code> is a <code>BIGINT</code>)</p>
  
  <p>When this does not:</p>
  
  <pre class="lang-sql prettyprint-override"><code>CAST(DATE_FORMAT(`Login_Activity_Temp`.`timestamp`,'%Y%m%d') AS UNSIGNED)
  </code></pre>
  
  <p>(where <code>Login_Activity_Temp.timestamp</code> is a <code>DATETIME</code>)</p>
  
  <p>I need the last one (or something similar) to work.</p>
  
  <p>--- UPDATED ---</p>
  
  <p>I does work!!!
  (Thanks all)</p>