title: Changing the date format of the column values in a Spark dataframe
body: <p>I am reading an Excel sheet into a <code>Dataframe</code> in Spark 2.0 and then trying to convert some columns with date values in <code>MM/DD/YY</code> format into <code>YYYY-MM-DD</code> format. <strong>The values are in string format.</strong> Below is the sample:</p>
  <pre class="lang-none prettyprint-override"><code>+---------------+--------------+
  |modified       |      created |
  +---------------+--------------+
  |           null| 12/4/17 13:45|
  |        2/20/18|  2/2/18 20:50|
  |        3/20/18|  2/2/18 21:10|
  |        2/20/18|  2/2/18 21:23|
  |        2/28/18|12/12/17 15:42| 
  |        1/25/18| 11/9/17 13:10|
  |        1/29/18| 12/6/17 10:07| 
  +---------------+--------------+
  </code></pre>
  <p>I would like this to be converted to:</p>
  <pre class="lang-none prettyprint-override"><code>+---------------+-----------------+
  |modified       |      created    |
  +---------------+-----------------+
  |           null| 2017-12-04 13:45|
  |     2018-02-20| 2018-02-02 20:50|
  |     2018-03-20| 2018-02-02 21:10|
  |     2018-02-20| 2018-02-02 21:23|
  |     2018-02-28| 2017-12-12 15:42| 
  |     2018-01-25| 2017-11-09 13:10|
  |     2018-01-29| 2017-12-06 10:07| 
  +---------------+-----------------+
  </code></pre>
  <p>So I tried doing:</p>
  <pre><code>df.withColumn(&quot;modified&quot;,date_format(col(&quot;modified&quot;),&quot;yyyy-MM-dd&quot;))
    .withColumn(&quot;created&quot;,to_utc_timestamp(col(&quot;created&quot;),&quot;America/New_York&quot;))
  </code></pre>
  <p>But it gives me all <code>NULL</code> values in my result. I am not sure where I am going wrong. I know that <code>to_utc_timestamp</code> on <code>created</code> will convert the whole timestamp into UTC. Ideally I would like to keep the time unchanged and only change the date format. Is there a way to achieve what I am trying to do? and Where am I going wrong?</p>