title: Can unix_timestamp() return unix time in milliseconds in Apache Spark?
body: <p>I'm trying to get the unix time from a timestamp field in milliseconds (13 digits) but currently it returns in seconds (10 digits). </p>
  
  <pre><code>scala&gt; var df = Seq("2017-01-18 11:00:00.000", "2017-01-18 11:00:00.123", "2017-01-18 11:00:00.882", "2017-01-18 11:00:02.432").toDF()
  df: org.apache.spark.sql.DataFrame = [value: string]
  
  scala&gt; df = df.selectExpr("value timeString", "cast(value as timestamp) time")
  df: org.apache.spark.sql.DataFrame = [timeString: string, time: timestamp]
  
  
  scala&gt; df = df.withColumn("unix_time", unix_timestamp(df("time")))
  df: org.apache.spark.sql.DataFrame = [timeString: string, time: timestamp ... 1 more field]
  
  scala&gt; df.take(4)
  res63: Array[org.apache.spark.sql.Row] = Array(
  [2017-01-18 11:00:00.000,2017-01-18 11:00:00.0,1484758800], 
  [2017-01-18 11:00:00.123,2017-01-18 11:00:00.123,1484758800], 
  [2017-01-18 11:00:00.882,2017-01-18 11:00:00.882,1484758800], 
  [2017-01-18 11:00:02.432,2017-01-18 11:00:02.432,1484758802])
  </code></pre>
  
  <p>Even though <code>2017-01-18 11:00:00.123</code> and <code>2017-01-18 11:00:00.000</code> are different, I get the same unix time back <code>1484758800</code></p>
  
  <p>What am I missing?</p>