title: How to read date, time and Timestamp from hbase column
body: <p>I create following table in Hbase using Phoenix. </p>
  
  <pre><code>CREATE TABLE test_Table
  ( test_date date not null,
  CONSTRAINT PK_test PRIMARY KEY (test_date)
  );
  </code></pre>
  
  <p>Then insert one record into the same using following command.</p>
  
  <pre><code>upsert into test_Table(test_date) values('2013-11-30');
  </code></pre>
  
  <p>I am able to read string, int, float and double data type values from Hbase using. Hbase client API but not date type.</p>
  
  <p>I am using following code to read all but not sure how to read date from Bytes.</p>
  
  <pre><code>    import org.apache.spark._
      import org.apache.spark.rdd._
      import org.apache.spark.sql.SQLContext
      import org.apache.spark.sql.DataFrame
      import org.apache.hadoop.conf.Configuration
      import org.apache.hadoop.fs.Path
      import org.apache.hadoop.hbase.HBaseConfiguration
      import org.apache.hadoop.hbase.spark.HBaseContext
      import org.apache.hadoop.hbase.client.Scan
      import org.apache.hadoop.hbase.util.Bytes
      import org.apache.spark.sql.types._
      import org.apache.hadoop.hbase.filter.PrefixFilter
      import org.apache.hadoop.hbase.{ TableName, HBaseConfiguration }
      import java.io.File
      import java.text.SimpleDateFormat
  
  def scanHBaseTable(tableName: String, sqlContext: SQLContext): Unit = {
  
  @transient val conf = getHbaseConfiguration();
  @transient var scan = new Scan()
  //scan.setAllowPartialResults(Constants.ALLOW_HBASE_PARTIAL_SCAN)
  //scan.setCaching(Constants.HBASE_SCAN_CACHE)  
  
  val hbaseContext = new HBaseContext(sqlContext.sparkContext, conf);
  val hbaseRawRDD = hbaseContext.hbaseRDD(TableName.valueOf(tableName), scan)
  hbaseRawRDD.foreach(v =&gt;
    {
      println(Bytes.toString(v._1.get()))
      println((new SimpleDateFormat("yyyy-MM-dd").parse(Bytes.toString(v._1.get()))))
    })
  
  println("Length: " + hbaseRawRDD.map(r =&gt; r._1.copyBytes()).collect().length);
  </code></pre>
  
  <p>}</p>
  
  <p>Can someone provide me solution for the same?</p>