title: PySpark add a column to a DataFrame from a TimeStampType column
body: <p>I have a DataFrame that look something like that. I want to operate on the day of the <code>date_time</code> field. </p>
  
  <pre><code>root
   |-- host: string (nullable = true)
   |-- user_id: string (nullable = true)
   |-- date_time: timestamp (nullable = true)
  </code></pre>
  
  <p>I tried to add a column to extract the day. So far my attempts have failed.</p>
  
  <pre><code>df = df.withColumn("day", df.date_time.getField("day"))
  
  org.apache.spark.sql.AnalysisException: GetField is not valid on fields of type TimestampType;
  </code></pre>
  
  <p>This has also failed</p>
  
  <pre><code>df = df.withColumn("day", df.select("date_time").map(lambda row: row.date_time.day))
  
  AttributeError: 'PipelinedRDD' object has no attribute 'alias'
  </code></pre>
  
  <p>Any idea how this can be done?</p>