title: Get a substring in hive
body: <p>I am trying to get a substring of a string from Hive. I have a string as this one: 2017-06-05 09:06:32.0</p>
  
  <p>What I want is to get the first two digits from hour, that is, 09.
  I get the entire hour with this command:</p>
  
  <pre><code>SELECT SUBSTR(hora,11) AS subhoras FROM axmugbcn18.bbdd WHERE hora =  '2017-06-05 09:06:32.0'
  </code></pre>
  
  <p>The result of the command is: 09:06:32.0</p>
  
  <p>In order to get only 09 I try this command:</p>
  
  <pre><code>SELECT REGEXP_EXTRACT(hora,'\d\d') AS subhoras FROM axmugbcn18.bbdd WHERE hora = '2017-06-05 09:09:32.0'
  </code></pre>
  
  <p>but results are blank.</p>
  
  <p>How can I retrieve only the two digits of hour?</p>
  
  <p>Thanks </p>