title: convert long to timestamp when downloading dates from BigQuery - java
body: <p>I am downloading data from bigquery. 
  using the <code>com.google.cloud.bigquery</code> library
  using the following code:</p>
  
  <pre><code>    String queryString = "SELECT * FROM `datasetId.tableId` where field=val;";
      BigQuery bigquery = BigQueryOptions.getDefaultInstance().getService();
      // Create a query request
      QueryRequest queryRequest =
              QueryRequest.newBuilder(queryString)
                      .setMaxWaitTime(60000L)
                      .setPageSize(1000L)
                      .setUseLegacySql(false)
                      .build();
      // Request query to be executed and wait for results
      QueryResponse queryResponse = bigquery.query(queryRequest);
      while (!queryResponse.jobCompleted()) {
          Thread.sleep(1000L);
          queryResponse = bigquery.getQueryResults(queryResponse.getJobId());
      }
      // Read rows
      Iterator&lt;List&lt;FieldValue&gt;&gt; rowIterator = queryResponse.getResult().iterateAll();
      while (rowIterator.hasNext()) {
          System.out.println(rowIterator.next());
      }
  </code></pre>
  
  <p>In bigquery this is my data :</p>
  
  <p><code>{time: "2017-01-18 08:28:55 UTC", date: "2016-09-22 14:37:52 UTC"}</code></p>
  
  <p>when I download I get this value:</p>
  
  <pre><code>time -&gt; "1.484728135674E9" date -&gt; "1.474555072424E9"
  </code></pre>
  
  <p>So i tried converting using this code:</p>
  
  <pre><code>private String convert(String value) {
      long lng = (long) Double.parseDouble(value);
      Date date = new Date(lng * 1000);
      DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
      return dateFormat.format(date);
  }
  </code></pre>
  
  <p>but i get this: </p>
  
  <pre><code> time -&gt;"2017-01-18T10:28:55.000Z" date -&gt; "2016-09-22T17:37:52.000Z"
  </code></pre>
  
  <p>(one date is in 2 hrs diff and the other 3 hrs diff!!??!!)</p>
  
  <p>how can I get the original values?</p>