title: Converting timestamp to UTC in Spark Scala
body: <p>My Environment is Spark 2.1, Scala</p>
  
  <p>This could be simple, but I am breaking my head.</p>
  
  <p>My Dataframe, myDF is like bellow -  </p>
  
  <pre><code>+--------------------+----------------+  
  |     orign_timestamp | origin_timezone|  
  +--------------------+----------------+  
  |2018-05-03T14:56:...|America/St_Johns|  
  |2018-05-03T14:56:...| America/Toronto|  
  |2018-05-03T14:56:...| America/Toronto|    
  |2018-05-03T14:56:...| America/Toronto|  
  |2018-05-03T14:56:...| America/Halifax|  
  |2018-05-03T14:56:...| America/Toronto|  
  |2018-05-03T14:56:...| America/Toronto|  
  +--------------------+----------------+   
  </code></pre>
  
  <p>I need to convert orign_timestamp to UTC and add as new column to DF. Code bellow is working fine.</p>
  
  <pre><code>myDF.withColumn("time_utc", to_utc_timestamp(from_unixtime(unix_timestamp(col("orign_timestamp"), "yyyy-MM-dd'T'HH:mm:ss")),("America/Montreal"))).show
  </code></pre>
  
  <p>Problem is I have fixed timezone to "America/Montreal". I need to pass timeZone form "orign_timeone" column. I tried </p>
  
  <pre><code>myDF.withColumn("time_utc", to_utc_timestamp(from_unixtime(unix_timestamp(col("orign_timestamp"), "yyyy-MM-dd'T'HH:mm:ss")), col("orign_timezone".toString.trim))).show
  
  got Error:
  &lt;console&gt;:34: error: type mismatch;
   found   : org.apache.spark.sql.Column
   required: String
  </code></pre>
  
  <p>I tried code bellow, did not through exception but new column had same time as origin_time.</p>
  
  <pre><code>myDF.withColumn("origin_timestamp", to_utc_timestamp(from_unixtime(unix_timestamp(col("orign_timestamp"), "yyyy-MM-dd'T'HH:mm:ss")), col("rign_timezone").toString)).show
  </code></pre>