title: Extract date from a string column containing timestamp in Pyspark
body: <p>I have a dataframe which has a date in the following format:</p>
  
  <pre><code>+----------------------+
  |date                  |
  +----------------------+
  |May 6, 2016 5:59:34 AM|
  +----------------------+
  </code></pre>
  
  <p>I intend to extract the date from this in the format <code>YYYY-MM-DD</code> ; so the result should be for the above date - 2016-05-06.</p>
  
  <p>But when I extract is using the following:</p>
  
  <pre><code>df.withColumn('part_date', from_unixtime(unix_timestamp(df.date, "MMM dd, YYYY hh:mm:ss aa"), "yyyy-MM-dd"))
  </code></pre>
  
  <p>I get the following date </p>
  
  <pre><code>2015-12-27
  </code></pre>
  
  <p>Can anyone please advise on this? I do not intend to convert my df to rdd to use datetime function from python and want to use this in the dataframe it self.</p>